From 0678e2e2bd5021390e19ec6fb8ee0b4f20e4c86d Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 27 Sep 2007 18:47:26 +0000 Subject: [PATCH] - Fixed mininova search engie plugin --- TODO | 1 + src/search_engine/engines/mininova.py | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index ca71c11ad..1be2e22ad 100644 --- a/TODO +++ b/TODO @@ -79,6 +79,7 @@ LANGUAGES UPDATED: - Bulgarian *OK* rc1->rc2 changelog: +- BUGFIX: Fixed mininova search engine plugin - BUGFIX: Fixed infoBar text when adding a torrent - BUGFIX: Fixed a unsupported character in man page - I18N: Updated Italian and Korean translations diff --git a/src/search_engine/engines/mininova.py b/src/search_engine/engines/mininova.py index 0cccd478e..dca2b4d31 100644 --- a/src/search_engine/engines/mininova.py +++ b/src/search_engine/engines/mininova.py @@ -1,4 +1,4 @@ -#VERSION: 1.10 +#VERSION: 1.11 #AUTHORS: Fabien Devaux (fab@gnux.info) from novaprinter import prettyPrinter import urllib @@ -15,11 +15,13 @@ class mininova(object): def get_link(lnk): lnks = lnk.getElementsByTagName('a') - if lnks.item(0).attributes.get('href').value.startswith('/faq'): - if len(lnks) > 1: - return self.url+lnks.item(1).attributes.get('href').value - else: - return self.url+lnks.item(0).attributes.get('href').value + i = 0 + try: + while not lnks.item(i).attributes.get('href').value.startswith('/get'): + i += 1 + except: + return None + return (self.url+lnks.item(i).attributes.get('href').value).strip() def get_text(txt): if txt.nodeType == txt.TEXT_NODE: @@ -43,7 +45,7 @@ class mininova(object): vals = {} for td in tds: if self.table_items[i] == 'name': - vals['link'] = get_link(td).strip() + vals['link'] = get_link(td) vals[self.table_items[i]] = get_text(td).strip() i += 1 vals['engine_url'] = self.url @@ -51,6 +53,8 @@ class mininova(object): vals['seeds'] = 0 if not vals['leech'].isdigit(): vals['leech'] = 0 + if vals['link'] is None: + continue prettyPrinter(vals) res = res + 1 if res == 0: