summaryrefslogtreecommitdiff
path: root/searx/engines/google_news.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-06-11 17:00:12 +0200
committerGitHub <noreply@github.com>2021-06-11 17:00:12 +0200
commit52db47a1c98cfe50810b9b6eeb2c08e4abfae077 (patch)
treeb5436a2abc586970290a98e1a4bd16b82566f766 /searx/engines/google_news.py
parent7a436a5060c41399e178ee4c8f0ddc1ff50470ad (diff)
parent2ac3e5b20b50045574d55ff01cfa19f3ca9da8b9 (diff)
Merge pull request #134 from searxng/google-default-language
[enh] google engine: supports "default language"
Diffstat (limited to 'searx/engines/google_news.py')
-rw-r--r--searx/engines/google_news.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index 355155de8..485d602bc 100644
--- a/searx/engines/google_news.py
+++ b/searx/engines/google_news.py
@@ -83,8 +83,10 @@ def request(query, params):
lang_info = get_lang_info(
# pylint: disable=undefined-variable
- params, supported_languages, language_aliases
+ params, supported_languages, language_aliases, False
)
+ logger.debug(
+ "HTTP header Accept-Language --> %s", lang_info['headers']['Accept-Language'])
# google news has only one domain
lang_info['subdomain'] = 'news.google.com'
@@ -102,18 +104,14 @@ def request(query, params):
query_url = 'https://' + lang_info['subdomain'] + '/search' + "?" + urlencode({
'q': query,
- 'hl': lang_info['hl'],
- 'lr': lang_info['lr'],
+ **lang_info['params'],
'ie': "utf8",
'oe': "utf8",
'gl': lang_info['country'],
}) + ('&ceid=%s' % ceid) # ceid includes a ':' character which must not be urlencoded
-
- logger.debug("query_url --> %s", query_url)
params['url'] = query_url
- logger.debug("HTTP header Accept-Language --> %s", lang_info['Accept-Language'])
- params['headers']['Accept-Language'] = lang_info['Accept-Language']
+ params['headers'].update(lang_info['headers'])
params['headers']['Accept'] = (
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
)