summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorMichael Ilsaas <mikeri@mikeri.net>2021-03-07 18:14:30 +0100
committerMichael Ilsaas <mikeri@mikeri.net>2021-03-07 18:14:30 +0100
commit5549d58de3512203943308c8fbe23c1d7187c96d (patch)
treea807113debf1ff3969e1638a2a198b19ce7fa211 /searx
parent0d8b369b5b300e8a575d6715fc75067d09db63a5 (diff)
downloadsearxng-5549d58de3512203943308c8fbe23c1d7187c96d.tar.gz
searxng-5549d58de3512203943308c8fbe23c1d7187c96d.zip
Add Solid Torrents engine
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/solidtorrents.py53
-rw-r--r--searx/settings.yml6
2 files changed, 59 insertions, 0 deletions
diff --git a/searx/engines/solidtorrents.py b/searx/engines/solidtorrents.py
new file mode 100644
index 000000000..050149187
--- /dev/null
+++ b/searx/engines/solidtorrents.py
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+"""Solid Torrents
+
+"""
+
+# pylint: disable=missing-function-docstring
+
+from json import loads
+from urllib.parse import urlencode
+from searx import logger
+
+logger = logger.getChild('solidtor engine')
+
+about = {
+ "website": 'https://www.solidtorrents.net/',
+ "wikidata_id": None,
+ "official_api_documentation": None,
+ "use_official_api": True,
+ "require_api_key": False,
+ "results": 'JSON',
+}
+
+categories = ['files']
+paging = True
+
+base_url = 'https://www.solidtorrents.net/'
+search_url = base_url + 'api/v1/search?{query}'
+
+
+def request(query, params):
+ skip = (params['pageno'] - 1) * 20
+ query = urlencode({'q': query, 'skip': skip})
+ params['url'] = search_url.format(query=query)
+ logger.debug("query_url --> %s", params['url'])
+ return params
+
+
+def response(resp):
+ results = []
+ search_results = loads(resp.text)
+
+ for result in search_results["results"]:
+ results.append({
+ 'infohash': result["infohash"],
+ 'seed': result["swarm"]["seeders"],
+ 'leech': result["swarm"]["leechers"],
+ 'title': result["title"],
+ 'link': "https://solidtorrents.net/view/" + result["_id"],
+ 'filesize': result["size"],
+ 'magnetlink': result["magnet"],
+ 'template': "torrent.html",
+ })
+ return results
diff --git a/searx/settings.yml b/searx/settings.yml
index e45afb59b..55da9d402 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -956,6 +956,12 @@ engines:
timeout : 6.0
disabled : True
+ - name : solidtorrents
+ engine : solidtorrents
+ shortcut : solid
+ timeout : 3.0
+ disabled : True
+
- name : torrentz
engine : torrentz
shortcut : tor