summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-10-07 11:38:27 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2021-10-07 15:27:55 +0000
commit3abbe6d25bb001b6ef25144426b2539e1ed4c827 (patch)
treeaaa4fc0837903d4adae913bc7094ce891b72d3c2 /searx/engines
parent9fb77065bd80e04527c15ea4bdbb1f2ce10eddb8 (diff)
downloadsearxng-3abbe6d25bb001b6ef25144426b2539e1ed4c827.tar.gz
searxng-3abbe6d25bb001b6ef25144426b2539e1ed4c827.zip
[fix] engine torznab - categories, before join convert int to str
BTW add init() function and replace SearxEngineAPIException by ValueError. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/torznab.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/searx/engines/torznab.py b/searx/engines/torznab.py
index fed6b1fd1..960d1ee90 100644
--- a/searx/engines/torznab.py
+++ b/searx/engines/torznab.py
@@ -35,10 +35,11 @@ api_key = ''
# https://newznab.readthedocs.io/en/latest/misc/api/#predefined-categories
torznab_categories = []
+def init(engine_settings=None): # pylint: disable=unused-argument
+ if len(base_url) < 1:
+ raise ValueError('missing torznab base_url')
def request(query, params):
- if len(base_url) < 1:
- raise SearxEngineAPIException('missing torznab base_url')
search_url = base_url + '?t=search&q={search_query}'
if len(api_key) > 0:
@@ -47,14 +48,13 @@ def request(query, params):
search_url += '&cat={torznab_categories}'
params['url'] = search_url.format(
- search_query=quote(query),
- api_key=api_key,
- torznab_categories=",".join(torznab_categories)
+ search_query = quote(query),
+ api_key = api_key,
+ torznab_categories = ",".join([str(x) for x in torznab_categories])
)
return params
-
def response(resp):
results = []