Revert of #195 when the search language is not english

Sometimes there is two requests to google (depending of the source IP) : one to google.com, the second to google.fr (for instance).

Going to https://www.google.com/ncr and saving the PREF cookie for future use prevent this (there is no redirection).

But, recently (or not ?), by doing this the search returns English results even if the Accept-Language is specified.

There is still a way to prevent this : going to preference, set the search language. I don't know if this can be done by searx.

For now, a quick fix is to disable the use of the PREF cookie when the search language is not English (google engine will slower but returns excepted results).
This commit is contained in:
Alexandre Flament 2015-05-01 21:20:09 +02:00
parent bbd83f5a51
commit 8a69ade875
1 changed files with 2 additions and 1 deletions

View File

@ -76,6 +76,7 @@ def request(query, params):
query=urlencode({'q': query})) query=urlencode({'q': query}))
params['headers']['Accept-Language'] = language params['headers']['Accept-Language'] = language
if language.startswith('en'):
params['cookies']['PREF'] = get_google_pref_cookie() params['cookies']['PREF'] = get_google_pref_cookie()
return params return params