mirror of
https://github.com/searxng/searxng.git
synced 2025-12-28 06:30:02 +00:00
Google news' unit test
This commit is contained in:
@@ -20,7 +20,7 @@ language_support = True
|
||||
|
||||
# engine dependent config
|
||||
url = 'https://ajax.googleapis.com/'
|
||||
search_url = url + 'ajax/services/search/news?v=2.0&start={offset}&rsz=large&safe=off&filter=off&{query}&hl={language}' # noqa
|
||||
search_url = url + 'ajax/services/search/news?v=2.0&start={offset}&rsz=large&safe=off&filter=off&{query}&hl={lang}'
|
||||
|
||||
|
||||
# do search-request
|
||||
@@ -33,7 +33,7 @@ def request(query, params):
|
||||
|
||||
params['url'] = search_url.format(offset=offset,
|
||||
query=urlencode({'q': query}),
|
||||
language=language)
|
||||
lang=language)
|
||||
|
||||
return params
|
||||
|
||||
@@ -52,6 +52,8 @@ def response(resp):
|
||||
for result in search_res['responseData']['results']:
|
||||
# parse publishedDate
|
||||
publishedDate = parser.parse(result['publishedDate'])
|
||||
if 'url' not in result:
|
||||
continue
|
||||
|
||||
# append result
|
||||
results.append({'url': result['unescapedUrl'],
|
||||
|
||||
Reference in New Issue
Block a user