From 385e9b5c9e2d1caa73f99dac0bf1be1c46505121 Mon Sep 17 00:00:00 2001 From: Gordon Quad Date: Sat, 13 Jun 2020 22:42:16 +0100 Subject: add correction support for duckduckgo --- searx/engines/duckduckgo.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'searx/engines') diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index 0d2c0af2d..6e07b5021 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -50,6 +50,7 @@ result_xpath = '//div[@class="result results_links results_links_deep web-result url_xpath = './/a[@class="result__a"]/@href' title_xpath = './/a[@class="result__a"]' content_xpath = './/a[@class="result__snippet"]' +correction_xpath = '//div[@id="did_you_mean"]//a' # match query's language to a region code that duckduckgo will accept @@ -125,6 +126,11 @@ def response(resp): 'content': content, 'url': res_url}) + # parse correction + for correction in eval_xpath(doc, correction_xpath): + # append correction + results.append({'correction': extract_text(correction)}) + # return results return results -- cgit v1.2.3 From 71db7b1238001756a45a51018774bd9df8c81a39 Mon Sep 17 00:00:00 2001 From: Sophie Tauchert <999eagle@999eagle.moe> Date: Mon, 29 Jun 2020 14:48:56 +0200 Subject: Fix YaCy text results returned as images --- searx/engines/yacy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/engines') diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py index 25bc83687..f1d4c6abe 100644 --- a/searx/engines/yacy.py +++ b/searx/engines/yacy.py @@ -75,7 +75,7 @@ def response(resp): for result in search_results[0].get('items', []): # parse image results - if result.get('image'): + if result.get('image') and result.get('width') and result.get('height'): result_url = '' if 'url' in result: -- cgit v1.2.3