summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-01-24 09:13:48 +0100
committerGitHub <noreply@github.com>2021-01-24 09:13:48 +0100
commitf4a17acb7a4fa82c5cb629f4eaad11ef528f89e4 (patch)
treeef8d924b3cb3cc5e61ae73bf12ef5fb2f84bc336
parent96c2996857981dd3ece0c14dc88c6d2232d85fc7 (diff)
parent8c46b767d096eac82d1382a3d802c956cb7f3d64 (diff)
Merge pull request #2498 from dalf/minor-fix-google-news
[fix] google_news: avoid one HTTP redirect except for the English results
-rw-r--r--searx/engines/google_news.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index f5f289bb7..e83b2ba48 100644
--- a/searx/engines/google_news.py
+++ b/searx/engines/google_news.py
@@ -85,7 +85,7 @@ def request(query, params):
query_url = 'https://'+ subdomain + '/search' + "?" + urlencode({
'q': query,
- 'hl': lang_country,
+ 'hl': language,
'lr': "lang_" + language,
'ie': "utf8",
'oe': "utf8",
@@ -108,6 +108,10 @@ def request(query, params):
params['headers']['Accept'] = (
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
)
+
+ # hl=en redirect to hl=en-US / en-CA ...
+ params['soft_max_redirects'] = 1
+
#params['google_subdomain'] = subdomain
return params