[vlille] scrap webpage instead of provided xml
This commit is contained in:
parent
3b21f63936
commit
735c4600d9
2 changed files with 15 additions and 7 deletions
|
|
@ -97,10 +97,16 @@ class InfoStationPage(BasePage):
|
|||
class ListStationsPage(BasePage):
|
||||
def get_station_list(self):
|
||||
gauges = []
|
||||
for marker in self.parser.select(self.document.getroot(), 'marker'):
|
||||
gauge = Gauge(int(marker.get('id')))
|
||||
gauge.name = unicode(marker.get('name'))
|
||||
gauge.city = u"Lille"
|
||||
gauge.object = u'vLille'
|
||||
gauges.append(gauge)
|
||||
|
||||
trs = self.document.getroot().xpath('//table[@id="ctl00_Contenu_ListeStations1_ListViewStations_itemPlaceholderContainer"]/tr')
|
||||
|
||||
for tr in trs:
|
||||
if not ('id' in tr.attrib):
|
||||
tds = self.parser.select(tr, 'td/span', method='xpath')
|
||||
if len(tds) > 4:
|
||||
gauge = Gauge(int(tds[0].text))
|
||||
gauge.name = u'%s' % tds[1].text
|
||||
gauge.city = u'%s' % tds[3].text
|
||||
gauge.object = u'vLille'
|
||||
gauges.append(gauge)
|
||||
return gauges
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue