From b721c21ded94187f7d34e747e7dc8713515d23ce Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 24 Oct 2010 18:56:45 +0200 Subject: mahou_showtime: Fix brokenness with BeautifulSoup 3.1. --- modules/mahou_showtime.py | 10 ++++++---- 1 file 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.' -- cgit v1.2.3