summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/mahou_showtime.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/mahou_showtime.py b/modules/mahou_showtime.py
index 184b9f0..440c3a5 100644
--- a/modules/mahou_showtime.py
+++ b/modules/mahou_showtime.py
@@ -29,17 +29,25 @@ class Module:
return 'Failed to fetch showtime data.'
soup = BeautifulSoup(self.cache)
+ results = []
+
t = soup.find('table', attrs = {'summary': 'Currently Airing'})
trs = t.tr.td.table.findAll('tr')
del trs[0] # delete the "header" table row
-
for tr in trs:
tds = tr.findAll('td')
- title = tds[1].contents[0]
+ results.append((tds[1].contents[0], tds[3].contents[0], tds[5].contents[0], tds[6].contents[0].strip()))
+
+ t = soup.find('table', attrs = {'summary': 'Starting Soon'})
+ trs2 = t.tr.td.table.findAll('tr')
+ del trs2[0] # delete the "header" table row
+ for tr in trs2:
+ tds = tr.findAll('td')
+ results.append((tds[1].contents[0], tds[3].contents[0], tds[5].contents[0], tds[8].contents[0].strip()))
+
+ for r in results:
+ title, channel, airtime, eta = r
if all([x in title.lower() for x in search]):
- channel = tds[3].contents[0]
- airtime = tds[5].contents[0]
- eta = tds[6].contents[0].strip()
s = '%s airs on %s on %s (eta: %s)' % (title, channel, airtime, eta)
return s.encode('utf8')
return 'No match found.'