Browse Source

- Added multipage support for mininova

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
f0edd7dcf7
  1. 54
      src/search_engine/engines/mininova.py
  2. 2
      src/search_engine/engines/versions.txt

54
src/search_engine/engines/mininova.py

@ -1,4 +1,4 @@
#VERSION: 1.00 #VERSION: 1.10
#AUTHORS: Fabien Devaux (fab@gnux.info) #AUTHORS: Fabien Devaux (fab@gnux.info)
from novaprinter import prettyPrinter from novaprinter import prettyPrinter
import urllib import urllib
@ -26,25 +26,33 @@ class mininova(object):
return txt.toxml() return txt.toxml()
else: else:
return ''.join([ get_text(n) for n in txt.childNodes]) return ''.join([ get_text(n) for n in txt.childNodes])
dat = urllib.urlopen(self.url+'/search/%s/seeds'%(what,)).read().decode('utf-8', 'replace') page = 1
dat = re.sub("<a href=\"http://www.boardreader.com/index.php.*\"", "<a href=\"plop\"", dat) while True:
dat = re.sub("<=", "&lt;=", dat) res = 0
x = minidom.parseString(dat.encode('utf-8', 'replace')) dat = urllib.urlopen(self.url+'/search/%s/seeds/%d'%(what, page)).read().decode('utf-8', 'replace')
table = x.getElementsByTagName('table').item(0) dat = re.sub("<a href=\"http://www.boardreader.com/index.php.*\"", "<a href=\"plop\"", dat)
if not table: return dat = re.sub("<=", "&lt;=", dat)
for tr in table.getElementsByTagName('tr'): dat = re.sub("&\s", "&amp; ", dat)
tds = tr.getElementsByTagName('td') x = minidom.parseString(dat.encode('utf-8', 'replace'))
if tds: table = x.getElementsByTagName('table').item(0)
i = 0 if not table: return
vals = {} for tr in table.getElementsByTagName('tr'):
for td in tds: tds = tr.getElementsByTagName('td')
if self.table_items[i] == 'name': if tds:
vals['link'] = get_link(td).strip() i = 0
vals[self.table_items[i]] = get_text(td).strip() vals = {}
i += 1 for td in tds:
vals['engine_url'] = self.url if self.table_items[i] == 'name':
if not vals['seeds'].isdigit(): vals['link'] = get_link(td).strip()
vals['seeds'] = 0 vals[self.table_items[i]] = get_text(td).strip()
if not vals['leech'].isdigit(): i += 1
vals['leech'] = 0 vals['engine_url'] = self.url
prettyPrinter(vals) if not vals['seeds'].isdigit():
vals['seeds'] = 0
if not vals['leech'].isdigit():
vals['leech'] = 0
prettyPrinter(vals)
res = res + 1
if res == 0:
break
page = page +1

2
src/search_engine/engines/versions.txt

@ -1,5 +1,5 @@
isohunt: 1.00 isohunt: 1.00
torrentreactor: 1.00 torrentreactor: 1.00
btjunkie: 1.10 btjunkie: 1.10
mininova: 1.00 mininova: 1.10
piratebay: 1.00 piratebay: 1.00
Loading…
Cancel
Save