on master help sign in
[fix] google_news: avoid one HTTP redirect except for the English results

also add params['soft_max_redirects'] = 1 to avoid false error reporting in /stats/errors

commit8c46b767d096eac82d1382a3d802c956cb7f3d64 authorAlexandre Flament <alex@al-f.net> dateSun 24 Jan 2021, 08:53 (6 years ago) parent7d24850
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