on master help sign in
[fix] google-news engine - KeyError: 'hl in request

Since we added - 1c67b6aec [enh] google engine: supports "default language" there is a KeyError: 'hl in request,error pattern:: ERROR:searx.searx.search.processor.online:engine google news : exception : 'hl' Traceback (most recent call last): File "searx/search/processors/online.py", line 144, in search search_results = self._search_basic(query, params) File "searx/search/processors/online.py", line 118, in _search_basic self.engine.request(query, params) File "searx/engines/google_news.py", line 97, in request if lang_info['hl'] == 'en': KeyError: 'hl' Closes: https://github.com/searxng/searxng/issues/154 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commitcbc50a9bc5ff5e81d12b9ea0808386941c8cf195 authorMarkus Heiser <markus.heiser@darmarit.de> dateFri 18 Jun 2021, 11:34 (5 years ago) parent98a6305
1 file changed+2−2
searx/engines/google_news.py+2−2
searx/engines/google_news.py+2−2
@@ -91,8 +91,8 @@ def request(query, params):
9191 ceid = "%s:%s" % (lang_info['country'], lang_info['language'])
9292
9393 # google news redirects en to en-US
94− if lang_info['hl'] == 'en':
95− lang_info['hl'] = 'en-US'
94+ if lang_info['params']['hl'] == 'en':
95+ lang_info['params']['hl'] = 'en-US'
9696
9797 # Very special to google-news compared to other google engines, the time
9898 # range is included in the search term.