on master help sign in
Merge pull request #2376 from dalf/fix-mojeek
033f39bAlexandre Flament
searx/engines/xpath.py+1−2
@@ -7,7 +7,6 @@ url_xpath = None
7content_xpath = None
7content_xpath = None
8title_xpath = None
8title_xpath = None
9thumbnail_xpath = False
9thumbnail_xpath = False
10−categories = []
11paging = False
10paging = False
12suggestion_xpath = ''
11suggestion_xpath = ''
13results_xpath = ''
12results_xpath = ''
@@ -39,7 +38,7 @@ def request(query, params):
39def response(resp):
38def response(resp):
40 results = []
39 results = []
41 dom = html.fromstring(resp.text)
40 dom = html.fromstring(resp.text)
42− is_onion = True if 'onions' in categories else False
41+ is_onion = True if 'onions' in categories else False # pylint: disable=undefined-variable
43
42
44 if results_xpath:
43 if results_xpath:
45 for result in eval_xpath_list(dom, results_xpath):
44 for result in eval_xpath_list(dom, results_xpath):
searx/results.py+3−2
@@ -309,10 +309,11 @@ class ResultContainer:
309
309
310 for res in results:
310 for res in results:
311 # FIXME : handle more than one category per engine
311 # FIXME : handle more than one category per engine
312− res['category'] = engines[res['engine']].categories[0]
312+ engine = engines[res['engine']]
313+ res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''
313
314
314 # FIXME : handle more than one category per engine
315 # FIXME : handle more than one category per engine
315− category = engines[res['engine']].categories[0]\
316+ category = res['category']\
316 + ':' + res.get('template', '')\
317 + ':' + res.get('template', '')\
317 + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
318 + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
318
319