summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-11 13:14:54 +0100
committerGitHub <noreply@github.com>2020-12-11 13:14:54 +0100
commit033f39bff7b3365256491014140e35aa1e974d4e (patch)
treee86f641ad1384d567fe978054a75f654c258ba8c /searx
parent6bc6d5e9fd2f85948a2690cf5710405d08489be8 (diff)
parent0ba74cd812573a70075c5ab12ac35145954fbcc6 (diff)
downloadsearxng-033f39bff7b3365256491014140e35aa1e974d4e.tar.gz
searxng-033f39bff7b3365256491014140e35aa1e974d4e.zip
Merge pull request #2376 from dalf/fix-mojeek
Fix mojeek
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/xpath.py3
-rw-r--r--searx/results.py5
2 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index d420e250a..1507176ec 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -7,7 +7,6 @@ url_xpath = None
content_xpath = None
title_xpath = None
thumbnail_xpath = False
-categories = []
paging = False
suggestion_xpath = ''
results_xpath = ''
@@ -39,7 +38,7 @@ def request(query, params):
def response(resp):
results = []
dom = html.fromstring(resp.text)
- is_onion = True if 'onions' in categories else False
+ is_onion = True if 'onions' in categories else False # pylint: disable=undefined-variable
if results_xpath:
for result in eval_xpath_list(dom, results_xpath):
diff --git a/searx/results.py b/searx/results.py
index 5bf4e6b9e..fb7e816eb 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -309,10 +309,11 @@ class ResultContainer:
for res in results:
# FIXME : handle more than one category per engine
- res['category'] = engines[res['engine']].categories[0]
+ engine = engines[res['engine']]
+ res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''
# FIXME : handle more than one category per engine
- category = engines[res['engine']].categories[0]\
+ category = res['category']\
+ ':' + res.get('template', '')\
+ ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')