diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mahou_showtime.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/mahou_showtime.py b/modules/mahou_showtime.py index 31dcc94..e4deefa 100644 --- a/modules/mahou_showtime.py +++ b/modules/mahou_showtime.py @@ -22,6 +22,8 @@ class Module: try: if time.time() - self.lastcache >= 60 or not self.cache: self.cache = urllib2.urlopen('http://www.mahou.org/Showtime/').read() + # missing space here seems to break BeautifulSoup's parsing + self.cache = self.cache.replace('summary=""border', 'summary="" border') self.lastcache = time.time() except: return 'Failed to fetch showtime data.' @@ -33,11 +35,11 @@ class Module: for tr in trs: tds = tr.findAll('td') - title = tds[1].text + title = tds[1].contents[0] if all([x in title.lower() for x in search]): - channel = tds[3].text - airtime = tds[5].text - eta = tds[6].text + channel = tds[3].contents[0] + airtime = tds[5].contents[0] + eta = tds[6].contents[0].strip() s = '%s airs on %s at %s (eta: %s)' % (title, channel, airtime, eta) return s.encode('utf8') return 'No match found.' |