Browse Source

Fix isohunt and vertor search plugins

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
fc3ae51122
  1. 8
      src/search_engine/engines/isohunt.py
  2. 4
      src/search_engine/engines/versions.txt
  3. 27
      src/search_engine/engines/vertor.py

8
src/search_engine/engines/isohunt.py

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
#VERSION: 1.31
#VERSION: 1.32
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without
@ -38,9 +38,9 @@ class isohunt(object): @@ -38,9 +38,9 @@ class isohunt(object):
print download_file(info)
def search(self, what, cat='all'):
# Remove {} since isohunt does not seem
# to handle those very well
what = what.replace('{', '').replace('}', '')
# Remove {} since isohunt does not seem
# to handle those very well
what = what.replace('{', '').replace('}', '')
i = 1
while True and i<11:
res = 0

4
src/search_engine/engines/versions.txt

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
isohunt: 1.31
isohunt: 1.32
torrentreactor: 1.21
btjunkie: 2.23
mininova: 1.40
piratebay: 1.30
vertor: 1.0
vertor: 1.1
torrentdownloads: 1.06

27
src/search_engine/engines/vertor.py

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
#VERSION: 1.0
#VERSION: 1.1
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without
@ -50,6 +50,8 @@ class vertor(object): @@ -50,6 +50,8 @@ class vertor(object):
self.td_counter = None
self.current_item = None
self.results = results
self.in_name = False
self.outside_td = True;
def start_a(self, attr):
params = dict(attr)
@ -58,29 +60,40 @@ class vertor(object): @@ -58,29 +60,40 @@ class vertor(object):
self.current_item = {}
self.td_counter = 0
self.current_item['link']=params['href'].strip()
elif self.td_counter == 0 and params.has_key('href') and params['href'].startswith("/torrents/") \
and not self.current_item.has_key('name'):
self.in_name = True
def end_a(self):
if self.in_name:
self.in_name = False
def handle_data(self, data):
if self.td_counter == 0:
if self.in_name:
if not self.current_item.has_key('name'):
self.current_item['name'] = ''
self.current_item['name']+= data.strip()
elif self.td_counter == 3:
elif self.td_counter == 2 and not self.outside_td:
if not self.current_item.has_key('size'):
self.current_item['size'] = ''
self.current_item['size']+= data.strip()
elif self.td_counter == 4:
elif self.td_counter == 4 and not self.outside_td:
if not self.current_item.has_key('seeds'):
self.current_item['seeds'] = ''
self.current_item['seeds']+= data.strip()
elif self.td_counter == 5:
elif self.td_counter == 5 and not self.outside_td:
if not self.current_item.has_key('leech'):
self.current_item['leech'] = ''
self.current_item['leech']+= data.strip()
def end_td(self):
self.outside_td = True
def start_td(self,attr):
if isinstance(self.td_counter,int):
self.outside_td = False
self.td_counter += 1
if self.td_counter > 6:
if self.td_counter > 5:
self.td_counter = None
# Display item
if self.current_item:
@ -99,7 +112,7 @@ class vertor(object): @@ -99,7 +112,7 @@ class vertor(object):
results = []
parser = self.SimpleSGMLParser(results, self.url)
dat = retrieve_url(self.url+'/index.php?mod=search&words=%s&cid=%s&orderby=a.seeds&asc=0&search=&exclude=&p=%d'%(what, self.supported_categories[cat], i))
results_re = re.compile('(?s)Vertor search results.*')
results_re = re.compile('(?s)<table class="listing">.*')
for match in results_re.finditer(dat):
res_tab = match.group(0)
parser.feed(res_tab)

Loading…
Cancel
Save