on master help sign in
Merge pull request #2498 from dalf/minor-fix-google-news

[fix] google_news: avoid one HTTP redirect except for the English results

commitf4a17acb7a4fa82c5cb629f4eaad11ef528f89e4 authorAlexandre Flament <alex@al-f.net> dateSun 24 Jan 2021, 09:13 (6 years ago) parent96c29968c46b76
1 file changed+5−1
searx/engines/google_news.py+5−1
searx/engines/google_news.py+5−1
@@ -85,7 +85,7 @@ def request(query, params):
8585
8686 query_url = 'https://'+ subdomain + '/search' + "?" + urlencode({
8787 'q': query,
88− 'hl': lang_country,
88+ 'hl': language,
8989 'lr': "lang_" + language,
9090 'ie': "utf8",
9191 'oe': "utf8",
@@ -108,6 +108,10 @@ def request(query, params):
108108 params['headers']['Accept'] = (
109109 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
110110 )
111+
112+ # hl=en redirect to hl=en-US / en-CA ...
113+ params['soft_max_redirects'] = 1
114+
111115 #params['google_subdomain'] = subdomain
112116
113117 return params