@@ -1,78 +0,0 @@
1−# Seedpeer (Videos, Music, Files)
3−# @website https://seedpeer.me
4−# @provide-api no (nothing found)
7−# @results HTML (using search portal)
8−# @stable yes (HTML can change)
9−# @parse url, title, content, seed, leech, magnetlink
12−from json import loads
13−from operator import itemgetter
14−from urllib.parse import quote, urljoin
15−from searx.utils import extract_text
18−url = 'https://seedpeer.me/'
19−search_url = url + 'search/{search_term}?page={page_no}'
20−torrent_file_url = url + 'torrent/{torrent_hash}'
22−# specific xpath variables
23−script_xpath = '//script[@type="text/javascript"][not(@src)]'
24−torrent_xpath = '(//table)[2]/tbody/tr'
25−link_xpath = '(./td)[1]/a/@href'
26−age_xpath = '(./td)[2]'
27−size_xpath = '(./td)[3]'
31−def request(query, params):
32− params['url'] = search_url.format(search_term=quote(query),
33− page_no=params['pageno'])
37−# get response from search-request
40− dom = html.fromstring(resp.text)
41− result_rows = dom.xpath(torrent_xpath)
44− script_element = dom.xpath(script_xpath)[0]
45− json_string = script_element.text[script_element.text.find('{'):]
46− torrents_json = loads(json_string)
51− for torrent_row, torrent_json in zip(result_rows, torrents_json['data']['list']):
52− title = torrent_json['name']
53− seed = int(torrent_json['seeds'])
54− leech = int(torrent_json['peers'])
55− size = int(torrent_json['size'])
56− torrent_hash = torrent_json['hash']
58− torrentfile = torrent_file_url.format(torrent_hash=torrent_hash)
59− magnetlink = 'magnet:?xt=urn:btih:{}'.format(torrent_hash)
61− age = extract_text(torrent_row.xpath(age_xpath))
62− link = torrent_row.xpath(link_xpath)[0]
64− href = urljoin(url, link)
67− results.append({'url': href,
73− 'torrentfile': torrentfile,
74− 'magnetlink': magnetlink,
75− 'template': 'torrent.html'})
77− # return results sorted by seeder
78− return sorted(results, key=itemgetter('seed'), reverse=True)