From 8df1f0c47e03fe7525c40a2856dba950bab8998b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 1 Aug 2022 17:01:59 +0200 Subject: [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 --- searx/engines/wikipedia.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'searx/engines/wikipedia.py') diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py index cc806a8de..52b1053ed 100644 --- a/searx/engines/wikipedia.py +++ b/searx/engines/wikipedia.py @@ -19,6 +19,9 @@ about = { "results": 'JSON', } + +send_accept_language_header = True + # search-url search_url = 'https://{language}.wikipedia.org/api/rest_v1/page/summary/{title}' supported_languages_url = 'https://meta.wikimedia.org/wiki/List_of_Wikipedias' @@ -41,9 +44,6 @@ def request(query, params): language = url_lang(params['language']) params['url'] = search_url.format(title=quote(query), language=language) - if params['language'].lower() in language_variants.get(language, []): - params['headers']['Accept-Language'] = params['language'].lower() - params['headers']['User-Agent'] = searx_useragent() params['raise_for_httperror'] = False params['soft_max_redirects'] = 2 -- cgit v1.2.3-54-g00ecf