diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2020-06-30 15:37:39 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-06-30 15:37:39 +0200 |
| commit | f14a7add31c8db54c90ee7bd8504e3f395faf944 (patch) | |
| tree | 42690fa0e0b77f81f87201635e4d3f73c4330739 /searx/engines/duckduckgo.py | |
| parent | ca1c3bd15d60faf235894cb4f6f3a15150e3a6c3 (diff) | |
| parent | c59ca600423367d54e9b301cf086deeb66602831 (diff) | |
Merge branch 'master' of https://github.com/asciimoo/searx into csp-oscar-theme
Diffstat (limited to 'searx/engines/duckduckgo.py')
| -rw-r--r-- | searx/engines/duckduckgo.py | 6 |
1 files changed, 6 insertions, 0 deletions
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 |