Catch special case in Belgium with Flandern and Wallonie
This commit is contained in:
15
charts.py
15
charts.py
@@ -143,7 +143,7 @@ entry %s'
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def parse_charts_list( self, page ):
|
def parse_charts_list( self, page, belgien=False ):
|
||||||
"""
|
"""
|
||||||
Handles the parsing process
|
Handles the parsing process
|
||||||
"""
|
"""
|
||||||
@@ -152,6 +152,10 @@ entry %s'
|
|||||||
wikicode = mwparser.parse( page.text )
|
wikicode = mwparser.parse( page.text )
|
||||||
|
|
||||||
# Select the section "Singles"
|
# Select the section "Singles"
|
||||||
|
if belgien:
|
||||||
|
singles_section = wikicode.get_sections(
|
||||||
|
matches=belgien )[0].get_sections( matches="Singles" )[0]
|
||||||
|
else:
|
||||||
singles_section = wikicode.get_sections( matches="Singles" )[0]
|
singles_section = wikicode.get_sections( matches="Singles" )[0]
|
||||||
|
|
||||||
# Select the last occurence of template "Nummer-eins-Hits Zeile" in
|
# Select the last occurence of template "Nummer-eins-Hits Zeile" in
|
||||||
@@ -230,7 +234,14 @@ entry %s'
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Parse linked charts list for the country
|
# Parse linked charts list for the country
|
||||||
data = self.parse_charts_list( list_page )
|
if "Wallonien" in str( country.get( "Liste" ).value ):
|
||||||
|
belgien = "Wallonie"
|
||||||
|
elif "Flandern" in str( country.get( "Liste" ).value ):
|
||||||
|
belgien = "Flandern"
|
||||||
|
else:
|
||||||
|
belgien = None
|
||||||
|
|
||||||
|
data = self.parse_charts_list( list_page, belgien )
|
||||||
|
|
||||||
# Update "Liste Revision" param
|
# Update "Liste Revision" param
|
||||||
country.get( "Liste Revision" ).value = str(
|
country.get( "Liste Revision" ).value = str(
|
||||||
|
|||||||
Reference in New Issue
Block a user