summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo_definitions.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2022-08-01 17:01:59 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2022-08-01 17:01:59 +0200
commit8df1f0c47e03fe7525c40a2856dba950bab8998b (patch)
tree844dc7ca4d31f0ff97c07d1817dbfba591420b30 /searx/engines/duckduckgo_definitions.py
parenta2badb4fe47eaa6df26b7bc0ef601cb9179edc3a (diff)
downloadsearxng-8df1f0c47e03fe7525c40a2856dba950bab8998b.tar.gz
searxng-8df1f0c47e03fe7525c40a2856dba950bab8998b.zip
[mod] add 'Accept-Language' HTTP header to online processores
Most engines that support languages (and regions) use the Accept-Language from the WEB browser to build a response that fits to the language (and region). - add new engine option: send_accept_language_header Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/duckduckgo_definitions.py')
-rw-r--r--searx/engines/duckduckgo_definitions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py
index ad3c92169..a73ee55ff 100644
--- a/searx/engines/duckduckgo_definitions.py
+++ b/searx/engines/duckduckgo_definitions.py
@@ -27,6 +27,8 @@ about = {
"results": 'JSON',
}
+send_accept_language_header = True
+
URL = 'https://api.duckduckgo.com/' + '?{query}&format=json&pretty=0&no_redirect=1&d=1'
WIKIDATA_PREFIX = ['http://www.wikidata.org/entity/', 'https://www.wikidata.org/entity/']
@@ -62,7 +64,6 @@ def request(query, params):
params['url'] = URL.format(query=urlencode({'q': query}))
language = match_language(params['language'], supported_languages, language_aliases)
language = language.split('-')[0]
- params['headers']['Accept-Language'] = language
return params