[opensubtitles] fix #1295

This commit is contained in:
Bezleputh 2014-08-31 20:24:45 +02:00
commit 6c9bb44c4b

View file

@ -41,7 +41,7 @@ class SearchPage(BasePage):
if len(links) > 0:
a = links[0]
url = a.attrib.get('href', '')
if "ads.opensubtitles" not in url:
if "ads2.opensubtitles" not in url:
self.browser.location("http://www.opensubtitles.org%s" % url)
assert self.browser.is_on_page(SubtitlesPage) or self.browser.is_on_page(SubtitlePage)
# subtitles page does the job
@ -107,9 +107,8 @@ class SubtitlePage(BasePage):
"""
def get_subtitle(self):
desc = NotAvailable
father = self.parser.select(self.document.getroot(), 'a#app_link', 1).getparent()
a = self.parser.select(father, 'a')[1]
id = a.attrib.get('href', '').split('/')[-1]
a = self.parser.select(self.document.getroot(), 'a#bt-dwl', 1)
id = a.attrib.get('rel', '').split('/')[-1]
m = re.match('Download \((\w+)\)', self.parser.tocleanstring(a))
if m:
ext = m.group(1)