diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-06-18 14:01:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-18 14:01:03 +0200 |
| commit | eb6832eb95f064a9450f5658f3cee52d374c6a31 (patch) | |
| tree | 8ee9883570d4fb0fa9c1363907e4e9fa9dabf630 | |
| parent | 4417d2b922fc01c44d0854d427a4e4c8603db861 (diff) | |
| parent | 9328c66e93afacc91564a475280c5167fb0216be (diff) | |
Merge pull request #156 from return42/fix-google-news
Fix google news
| -rw-r--r-- | searx/engines/google_news.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 485d602bc..c1c97b700 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -19,6 +19,7 @@ Definitions`_. Not all parameters can be appied: # pylint: disable=invalid-name, missing-function-docstring import binascii +from datetime import datetime import re from urllib.parse import urlencode from base64 import b64decode @@ -94,8 +95,8 @@ def request(query, params): ceid = "%s:%s" % (lang_info['country'], lang_info['language']) # google news redirects en to en-US - if lang_info['hl'] == 'en': - lang_info['hl'] = 'en-US' + if lang_info['params']['hl'] == 'en': + lang_info['params']['hl'] = 'en-US' # Very special to google-news compared to other google engines, the time # range is included in the search term. @@ -115,6 +116,7 @@ def request(query, params): params['headers']['Accept'] = ( 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' ) + params['headers']['Cookie'] = "CONSENT=YES+cb.%s-14-p0.en+F+941;" % datetime.now().strftime("%Y%m%d") return params |