summaryrefslogtreecommitdiff
path: root/bvggrabber/api/actualdeparture.py
diff options
context:
space:
mode:
Diffstat (limited to 'bvggrabber/api/actualdeparture.py')
-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()