Browse Source

Catch special case in Belgium with Flandern and Wallonie

develop
Jonathan Golder 9 years ago
parent
commit
329466c6f8
  1. 15
      charts.py

15
charts.py

@ -143,7 +143,7 @@ entry %s'
return True
return False
def parse_charts_list( self, page ):
def parse_charts_list( self, page, belgien=False ):
"""
Handles the parsing process
"""
@ -152,6 +152,10 @@ entry %s'
wikicode = mwparser.parse( page.text )
# 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]
# Select the last occurence of template "Nummer-eins-Hits Zeile" in
@ -230,7 +234,14 @@ entry %s'
"""
# 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
country.get( "Liste Revision" ).value = str(

Loading…
Cancel
Save