summaryrefslogtreecommitdiff
path: root/bvggrabber
diff options
context:
space:
mode:
authorChristian Struck <christian@struck.se>2013-01-29 17:47:29 +0100
committerChristian Struck <christian@struck.se>2013-01-29 17:47:29 +0100
commit2d00d20888b47a21848a0ce36ba8331560b60d93 (patch)
tree7147cf39e0059a160faf88c14676fe26b0a65470 /bvggrabber
parent80d58383a914b7c65d1d5debe3f78a31ddca5cf7 (diff)
downloadbvg-grabber-2d00d20888b47a21848a0ce36ba8331560b60d93.tar.gz
bvg-grabber-2d00d20888b47a21848a0ce36ba8331560b60d93.tar.bz2
bvg-grabber-2d00d20888b47a21848a0ce36ba8331560b60d93.zip
fixed a bug where not all buses are parsed.
Diffstat (limited to 'bvggrabber')
-rw-r--r--bvggrabber/api/actualdeparture.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/bvggrabber/api/actualdeparture.py b/bvggrabber/api/actualdeparture.py
index f6f5fe2..e4c3c26 100644
--- a/bvggrabber/api/actualdeparture.py
+++ b/bvggrabber/api/actualdeparture.py
@@ -38,18 +38,19 @@ class ActualDepartureQueryApi(QueryApi):
return (False, [])
else:
# The station seems to exist
- tbody = soup.find('tbody')
- if tbody is None:
+ result = soup.find('div', {'id': '', 'class': 'ivu_result_box'})
+ if result is None:
return (False, [])
- rows = tbody.find_all('tr')
+ rows = result.find_all('tr')
departures = []
for row in rows:
- tds = row.find_all('td')
- dep = Departure(start=self.station_enc,
- end=tds[2].text.strip(),
- when=tds[0].text.strip(),
- line=tds[1].text.strip())
- departures.append(dep)
+ td = row.find_all('td')
+ if td:
+ dep = Departure(start=self.station_enc,
+ end=td[2].text.strip(),
+ when=td[0].text.strip(),
+ line=td[1].text.strip())
+ departures.append(dep)
return (True, departures)
else:
response.raise_for_status()