From 36749d6e5b50cf50f4c3216b8605f7e70ba96cdb Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Thu, 6 Sep 2012 10:04:40 +0200 Subject: [PATCH] fix parsing title on whatcd --- modules/gazelle/pages/torrents.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/gazelle/pages/torrents.py b/modules/gazelle/pages/torrents.py index cf81b447..99dd73b1 100644 --- a/modules/gazelle/pages/torrents.py +++ b/modules/gazelle/pages/torrents.py @@ -119,11 +119,9 @@ class TorrentsPage(BasePage): def get_torrent(self, id): table = self.browser.parser.select(self.document.getroot(), 'div.thin', 1) - h2 = table.find('h2') - if h2 is not None: - title = h2.text or '' - if h2.find('a') != None: - title += (h2.find('a').text or '') + (h2.find('a').tail or '') + h2 = table.xpath('.//h2') + if len(h2) > 0: + title = u''.join([txt.strip() for txt in h2[0].itertext()]) else: title = self.browser.parser.select(table, 'div.title_text', 1).text