on master help sign in
Add Solid Torrents engine
commit5549d58de3512203943308c8fbe23c1d7187c96d authorMichael Ilsaas <mikeri@mikeri.net> dateSun 7 Mar 2021, 18:14 (6 years ago) parent0d8b369
3 files changed+60
Makefile+1 searx/engines/solidtorrents.py+53 searx/settings.yml+6
Makefile+1
@@ -195,6 +195,7 @@ PYLINT_FILES=\
195195 searx/engines/google_videos.py \
196196 searx/engines/google_images.py \
197197 searx/engines/mediathekviewweb.py \
198+ searx/engines/solidtorrents.py \
198199 searx/engines/google_scholar.py \
199200 searx_extra/update/update_external_bangs.py
200201
searx/engines/solidtorrents.pynew file+53
@@ -0,0 +1,53 @@
1+# SPDX-License-Identifier: AGPL-3.0-or-later
2+"""Solid Torrents
3+
4+"""
5+
6+# pylint: disable=missing-function-docstring
7+
8+from json import loads
9+from urllib.parse import urlencode
10+from searx import logger
11+
12+logger = logger.getChild('solidtor engine')
13+
14+about = {
15+ "website": 'https://www.solidtorrents.net/',
16+ "wikidata_id": None,
17+ "official_api_documentation": None,
18+ "use_official_api": True,
19+ "require_api_key": False,
20+ "results": 'JSON',
21+}
22+
23+categories = ['files']
24+paging = True
25+
26+base_url = 'https://www.solidtorrents.net/'
27+search_url = base_url + 'api/v1/search?{query}'
28+
29+
30+def request(query, params):
31+ skip = (params['pageno'] - 1) * 20
32+ query = urlencode({'q': query, 'skip': skip})
33+ params['url'] = search_url.format(query=query)
34+ logger.debug("query_url --> %s", params['url'])
35+ return params
36+
37+
38+def response(resp):
39+ results = []
40+ search_results = loads(resp.text)
41+
42+ for result in search_results["results"]:
43+ results.append({
44+ 'infohash': result["infohash"],
45+ 'seed': result["swarm"]["seeders"],
46+ 'leech': result["swarm"]["leechers"],
47+ 'title': result["title"],
48+ 'link': "https://solidtorrents.net/view/" + result["_id"],
49+ 'filesize': result["size"],
50+ 'magnetlink': result["magnet"],
51+ 'template': "torrent.html",
52+ })
53+ return results
searx/settings.yml+6
@@ -956,6 +956,12 @@ engines:
956956 timeout : 6.0
957957 disabled : True
958958
959+ - name : solidtorrents
960+ engine : solidtorrents
961+ shortcut : solid
962+ timeout : 3.0
963+ disabled : True
964+
959965 - name : torrentz
960966 engine : torrentz
961967 shortcut : tor