diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-10-24 18:56:45 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-10-24 18:56:45 +0200 |
commit | b721c21ded94187f7d34e747e7dc8713515d23ce (patch) | |
tree | ebfa2202a881e9d883a7d0e739af9197c1d7e588 | |
parent | 34f6671259b4a2be850fa74a11b38220aa4400de (diff) |
mahou_showtime: Fix brokenness with BeautifulSoup 3.1.
-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.' |