Browse Source

[Search engine] Update Torrentz2 search engine

adaptive-webui-19844
ngosang 8 years ago
parent
commit
77b27abc94
  1. 16
      src/searchengine/nova/engines/torrentz.py
  2. 2
      src/searchengine/nova/engines/versions.txt
  3. 16
      src/searchengine/nova3/engines/torrentz.py
  4. 2
      src/searchengine/nova3/engines/versions.txt

16
src/searchengine/nova/engines/torrentz.py

@ -1,4 +1,4 @@
#VERSION: 2.21 #VERSION: 2.22
#AUTHORS: Diego de las Heras (ngosang@hotmail.es) #AUTHORS: Diego de las Heras (ngosang@hotmail.es)
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@ class torrentz(object):
trackers_list = ['udp://tracker.coppersurfer.tk:6969/announce', trackers_list = ['udp://tracker.coppersurfer.tk:6969/announce',
'udp://tracker.opentrackr.org:1337/announce', 'udp://tracker.opentrackr.org:1337/announce',
'udp://zer0day.ch:1337/announce', 'udp://tracker.zer0day.to:1337/announce',
'udp://tracker.leechers-paradise.org:6969/announce', 'udp://tracker.leechers-paradise.org:6969/announce',
'udp://9.rarbg.com:2710/announce', 'udp://9.rarbg.com:2710/announce',
'udp://explodie.org:6969/announce'] 'udp://explodie.org:6969/announce']
@ -64,9 +64,7 @@ class torrentz(object):
elif tag == 'span': elif tag == 'span':
if self.td_counter is not None: if self.td_counter is not None:
self.td_counter += 1 self.td_counter += 1
if 'class' in params and params['class'] == 'pe': # hack to avoid Pending if self.td_counter > 5: # safety
self.td_counter += 2
if self.td_counter > 6: # safety
self.td_counter = None self.td_counter = None
def handle_data(self, data): def handle_data(self, data):
@ -74,17 +72,17 @@ class torrentz(object):
if 'name' not in self.current_item: if 'name' not in self.current_item:
self.current_item['name'] = '' self.current_item['name'] = ''
self.current_item['name'] += data self.current_item['name'] += data
elif self.td_counter == 4: elif self.td_counter == 3:
if 'size' not in self.current_item: if 'size' not in self.current_item:
self.current_item['size'] = data.strip() self.current_item['size'] = data.strip()
if self.current_item['size'] == 'Pending': if self.current_item['size'] == 'Pending':
self.current_item['size'] = '' self.current_item['size'] = ''
elif self.td_counter == 5: elif self.td_counter == 4:
if 'seeds' not in self.current_item: if 'seeds' not in self.current_item:
self.current_item['seeds'] = data.strip().replace(',', '') self.current_item['seeds'] = data.strip().replace(',', '')
if not self.current_item['seeds'].isdigit(): if not self.current_item['seeds'].isdigit():
self.current_item['seeds'] = 0 self.current_item['seeds'] = 0
elif self.td_counter == 6: elif self.td_counter == 5:
if 'leech' not in self.current_item: if 'leech' not in self.current_item:
self.current_item['leech'] = data.strip().replace(',', '') self.current_item['leech'] = data.strip().replace(',', '')
if not self.current_item['leech'].isdigit(): if not self.current_item['leech'].isdigit():
@ -112,7 +110,7 @@ class torrentz(object):
i = 0 i = 0
while i < 6: while i < 6:
# "what" is already urlencoded # "what" is already urlencoded
html = retrieve_url(self.url + '/any?f=%s&p=%d' % (what, i)) html = retrieve_url(self.url + '/search?f=%s&p=%d' % (what, i))
parser.feed(html) parser.feed(html)
if len(results_list) < 1: if len(results_list) < 1:
break break

2
src/searchengine/nova/engines/versions.txt

@ -5,4 +5,4 @@ mininova: 2.02
piratebay: 2.15 piratebay: 2.15
torlock: 2.0 torlock: 2.0
torrentreactor: 1.42 torrentreactor: 1.42
torrentz: 2.21 torrentz: 2.22

16
src/searchengine/nova3/engines/torrentz.py

@ -1,4 +1,4 @@
#VERSION: 2.21 #VERSION: 2.22
#AUTHORS: Diego de las Heras (ngosang@hotmail.es) #AUTHORS: Diego de las Heras (ngosang@hotmail.es)
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@ class torrentz(object):
trackers_list = ['udp://tracker.coppersurfer.tk:6969/announce', trackers_list = ['udp://tracker.coppersurfer.tk:6969/announce',
'udp://tracker.opentrackr.org:1337/announce', 'udp://tracker.opentrackr.org:1337/announce',
'udp://zer0day.ch:1337/announce', 'udp://tracker.zer0day.to:1337/announce',
'udp://tracker.leechers-paradise.org:6969/announce', 'udp://tracker.leechers-paradise.org:6969/announce',
'udp://9.rarbg.com:2710/announce', 'udp://9.rarbg.com:2710/announce',
'udp://explodie.org:6969/announce'] 'udp://explodie.org:6969/announce']
@ -64,9 +64,7 @@ class torrentz(object):
elif tag == 'span': elif tag == 'span':
if self.td_counter is not None: if self.td_counter is not None:
self.td_counter += 1 self.td_counter += 1
if 'class' in params and params['class'] == 'pe': # hack to avoid Pending if self.td_counter > 5: # safety
self.td_counter += 2
if self.td_counter > 6: # safety
self.td_counter = None self.td_counter = None
def handle_data(self, data): def handle_data(self, data):
@ -74,17 +72,17 @@ class torrentz(object):
if 'name' not in self.current_item: if 'name' not in self.current_item:
self.current_item['name'] = '' self.current_item['name'] = ''
self.current_item['name'] += data self.current_item['name'] += data
elif self.td_counter == 4: elif self.td_counter == 3:
if 'size' not in self.current_item: if 'size' not in self.current_item:
self.current_item['size'] = data.strip() self.current_item['size'] = data.strip()
if self.current_item['size'] == 'Pending': if self.current_item['size'] == 'Pending':
self.current_item['size'] = '' self.current_item['size'] = ''
elif self.td_counter == 5: elif self.td_counter == 4:
if 'seeds' not in self.current_item: if 'seeds' not in self.current_item:
self.current_item['seeds'] = data.strip().replace(',', '') self.current_item['seeds'] = data.strip().replace(',', '')
if not self.current_item['seeds'].isdigit(): if not self.current_item['seeds'].isdigit():
self.current_item['seeds'] = 0 self.current_item['seeds'] = 0
elif self.td_counter == 6: elif self.td_counter == 5:
if 'leech' not in self.current_item: if 'leech' not in self.current_item:
self.current_item['leech'] = data.strip().replace(',', '') self.current_item['leech'] = data.strip().replace(',', '')
if not self.current_item['leech'].isdigit(): if not self.current_item['leech'].isdigit():
@ -112,7 +110,7 @@ class torrentz(object):
i = 0 i = 0
while i < 6: while i < 6:
# "what" is already urlencoded # "what" is already urlencoded
html = retrieve_url(self.url + '/any?f=%s&p=%d' % (what, i)) html = retrieve_url(self.url + '/search?f=%s&p=%d' % (what, i))
parser.feed(html) parser.feed(html)
if len(results_list) < 1: if len(results_list) < 1:
break break

2
src/searchengine/nova3/engines/versions.txt

@ -5,4 +5,4 @@ mininova: 2.02
piratebay: 2.15 piratebay: 2.15
torlock: 2.0 torlock: 2.0
torrentreactor: 1.42 torrentreactor: 1.42
torrentz: 2.21 torrentz: 2.22

Loading…
Cancel
Save