From 6dd82353bbdbf6436396397708d2032381b7485e Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 10 Apr 2013 17:05:40 +0200 Subject: [PATCH] [seeklyrics] fix bad parsing in some cases --- modules/seeklyrics/pages.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/seeklyrics/pages.py b/modules/seeklyrics/pages.py index 2134f00b..75175c79 100644 --- a/modules/seeklyrics/pages.py +++ b/modules/seeklyrics/pages.py @@ -58,9 +58,11 @@ class SongResultsPage(BasePage): first = False continue artist = NotAvailable - ftitle = self.parser.select(tr, 'a > font > font', 1) - title = unicode(ftitle.getparent().getparent().text_content()) - id = ftitle.getparent().getparent().attrib.get('href', '').replace('/lyrics/', '').replace('.html', '') + tds = self.parser.select(tr, 'td') + assert len(tds) > 2 + title = unicode(tds[1].text_content()) + link = self.parser.select(tds[1], 'a', 1) + id = link.attrib.get('href', '').replace('/lyrics/', '').replace('.html', '') aartist = self.parser.select(tr, 'a')[-1] artist = unicode(aartist.text) songlyrics = SongLyrics(id, title)