1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-25 14:04:23 +00:00

- Fixed torrent names in mininova search engine

This commit is contained in:
Christophe Dumez 2008-01-28 12:26:44 +00:00
parent 596ec6ae4c
commit 1b7449ef4e
2 changed files with 25 additions and 13 deletions

View File

@ -1,4 +1,4 @@
#VERSION: 1.12 #VERSION: 1.13
#AUTHORS: Fabien Devaux (fab@gnux.info) #AUTHORS: Fabien Devaux (fab@gnux.info)
from novaprinter import prettyPrinter from novaprinter import prettyPrinter
import urllib import urllib
@ -14,14 +14,24 @@ class mininova(object):
order = 'seeds' # must be one in self.table_items order = 'seeds' # must be one in self.table_items
def get_link(lnk): def get_link(lnk):
lnks = lnk.getElementsByTagName('a') lnks = lnk.getElementsByTagName('a')
i = 0 i = 0
try: try:
while not lnks.item(i).attributes.get('href').value.startswith('/get'): while not lnks.item(i).attributes.get('href').value.startswith('/get'):
i += 1 i += 1
except: except:
return None return None
return (self.url+lnks.item(i).attributes.get('href').value).strip() return (self.url+lnks.item(i).attributes.get('href').value).strip()
def get_name(lnk):
lnks = lnk.getElementsByTagName('a')
i = 0
try:
while not lnks.item(i).attributes.get('href').value.startswith('/tor'):
i += 1
except:
return None
return lnks.item(i).firstChild.toxml()
def get_text(txt): def get_text(txt):
if txt.nodeType == txt.TEXT_NODE: if txt.nodeType == txt.TEXT_NODE:
@ -46,15 +56,17 @@ class mininova(object):
for td in tds: for td in tds:
if self.table_items[i] == 'name': if self.table_items[i] == 'name':
vals['link'] = get_link(td) vals['link'] = get_link(td)
vals[self.table_items[i]] = get_text(td).strip() vals['name'] = get_name(td)
else:
vals[self.table_items[i]] = get_text(td).strip()
i += 1 i += 1
vals['engine_url'] = self.url vals['engine_url'] = self.url
if not vals['seeds'].isdigit(): if not vals['seeds'].isdigit():
vals['seeds'] = 0 vals['seeds'] = 0
if not vals['leech'].isdigit(): if not vals['leech'].isdigit():
vals['leech'] = 0 vals['leech'] = 0
if vals['link'] is None: if vals['link'] is None:
continue continue
prettyPrinter(vals) prettyPrinter(vals)
res = res + 1 res = res + 1
if res == 0: if res == 0:

View File

@ -1,5 +1,5 @@
isohunt: 1.01 isohunt: 1.01
torrentreactor: 1.02 torrentreactor: 1.02
btjunkie: 1.12 btjunkie: 1.12
mininova: 1.12 mininova: 1.13
piratebay: 1.01 piratebay: 1.01