Fix isohunt and vertor search plugins

This commit is contained in:
Christophe Dumez 2010-10-20 20:27:32 +00:00
commit fc3ae51122
3 changed files with 26 additions and 13 deletions

View file

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

View file

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

View file

@ -1,4 +1,4 @@
#VERSION: 1.0 #VERSION: 1.1
#AUTHORS: Christophe Dumez (chris@qbittorrent.org) #AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -50,6 +50,8 @@ class vertor(object):
self.td_counter = None self.td_counter = None
self.current_item = None self.current_item = None
self.results = results self.results = results
self.in_name = False
self.outside_td = True;
def start_a(self, attr): def start_a(self, attr):
params = dict(attr) params = dict(attr)
@ -58,29 +60,40 @@ class vertor(object):
self.current_item = {} self.current_item = {}
self.td_counter = 0 self.td_counter = 0
self.current_item['link']=params['href'].strip() 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): def handle_data(self, data):
if self.td_counter == 0: if self.in_name:
if not self.current_item.has_key('name'): if not self.current_item.has_key('name'):
self.current_item['name'] = '' self.current_item['name'] = ''
self.current_item['name']+= data.strip() 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'): if not self.current_item.has_key('size'):
self.current_item['size'] = '' self.current_item['size'] = ''
self.current_item['size']+= data.strip() 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'): if not self.current_item.has_key('seeds'):
self.current_item['seeds'] = '' self.current_item['seeds'] = ''
self.current_item['seeds']+= data.strip() 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'): if not self.current_item.has_key('leech'):
self.current_item['leech'] = '' self.current_item['leech'] = ''
self.current_item['leech']+= data.strip() self.current_item['leech']+= data.strip()
def end_td(self):
self.outside_td = True
def start_td(self,attr): def start_td(self,attr):
if isinstance(self.td_counter,int): if isinstance(self.td_counter,int):
self.outside_td = False
self.td_counter += 1 self.td_counter += 1
if self.td_counter > 6: if self.td_counter > 5:
self.td_counter = None self.td_counter = None
# Display item # Display item
if self.current_item: if self.current_item:
@ -99,7 +112,7 @@ class vertor(object):
results = [] results = []
parser = self.SimpleSGMLParser(results, self.url) 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)) 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): for match in results_re.finditer(dat):
res_tab = match.group(0) res_tab = match.group(0)
parser.feed(res_tab) parser.feed(res_tab)