on master help sign in
[remove] seedpeer engine

the website is offline.

commit56c64d6b641a7bf63dd72dc407e4d3e46b0f80cd authorAlexandre Flament <alex@al-f.net> dateMon 7 Dec 2020, 21:02 (6 years ago) parentdeb1bde
2 files changed−84
searx/engines/seedpeer.py−78 searx/settings.yml−6
searx/engines/seedpeer.pydeleted−78
@@ -1,78 +0,0 @@
1−# Seedpeer (Videos, Music, Files)
2−#
3−# @website https://seedpeer.me
4−# @provide-api no (nothing found)
5−#
6−# @using-api no
7−# @results HTML (using search portal)
8−# @stable yes (HTML can change)
9−# @parse url, title, content, seed, leech, magnetlink
10−
11−from lxml import html
12−from json import loads
13−from operator import itemgetter
14−from urllib.parse import quote, urljoin
15−from searx.utils import extract_text
16−
17−
18−url = 'https://seedpeer.me/'
19−search_url = url + 'search/{search_term}?page={page_no}'
20−torrent_file_url = url + 'torrent/{torrent_hash}'
21−
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]'
28−
29−
30−# do search-request
31−def request(query, params):
32− params['url'] = search_url.format(search_term=quote(query),
33− page_no=params['pageno'])
34− return params
35−
36−
37−# get response from search-request
38−def response(resp):
39− results = []
40− dom = html.fromstring(resp.text)
41− result_rows = dom.xpath(torrent_xpath)
42−
43− try:
44− script_element = dom.xpath(script_xpath)[0]
45− json_string = script_element.text[script_element.text.find('{'):]
46− torrents_json = loads(json_string)
47− except:
48− return []
49−
50− # parse results
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']
57−
58− torrentfile = torrent_file_url.format(torrent_hash=torrent_hash)
59− magnetlink = 'magnet:?xt=urn:btih:{}'.format(torrent_hash)
60−
61− age = extract_text(torrent_row.xpath(age_xpath))
62− link = torrent_row.xpath(link_xpath)[0]
63−
64− href = urljoin(url, link)
65−
66− # append result
67− results.append({'url': href,
68− 'title': title,
69− 'content': age,
70− 'seed': seed,
71− 'leech': leech,
72− 'filesize': size,
73− 'torrentfile': torrentfile,
74− 'magnetlink': magnetlink,
75− 'template': 'torrent.html'})
76−
77− # return results sorted by seeder
78− return sorted(results, key=itemgetter('seed'), reverse=True)
searx/settings.yml−6
@@ -966,12 +966,6 @@ engines:
966966 page_size : 10
967967 disabled : True
968968
969− - name : seedpeer
970− shortcut : speu
971− engine : seedpeer
972− categories: files, music, videos
973−
974−
975969 - name : naver
976970 shortcut: nvr
977971 engine: xpath