mirror of
https://github.com/searxng/searxng.git
synced 2024-11-15 09:10:12 +01:00
[fix] \!goi irrelevant results AND display more results
This commit is contained in:
parent
e9f8412a6e
commit
13eec44b65
@ -63,16 +63,11 @@ def request(query, params):
|
|||||||
'https://'
|
'https://'
|
||||||
+ google_info['subdomain']
|
+ google_info['subdomain']
|
||||||
+ '/search'
|
+ '/search'
|
||||||
+ "?"
|
+ '?'
|
||||||
+ urlencode(
|
+ urlencode({'q': query, 'tbm': "isch", **google_info['params'], 'asearch': 'isch'})
|
||||||
{
|
# don't urlencode this because wildly different AND bad results
|
||||||
'q': query,
|
# pagination uses Zero-based numbering
|
||||||
'tbm': "isch",
|
+ f'&async=_fmt:json,p:1,ijn:{params["pageno"] - 1}'
|
||||||
**google_info['params'],
|
|
||||||
'asearch': 'isch',
|
|
||||||
'async': '_fmt:json,p:1,ijn:' + str(params['pageno']),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if params['time_range'] in time_range_dict:
|
if params['time_range'] in time_range_dict:
|
||||||
@ -80,9 +75,13 @@ def request(query, params):
|
|||||||
if params['safesearch']:
|
if params['safesearch']:
|
||||||
query_url += '&' + urlencode({'safe': filter_mapping[params['safesearch']]})
|
query_url += '&' + urlencode({'safe': filter_mapping[params['safesearch']]})
|
||||||
params['url'] = query_url
|
params['url'] = query_url
|
||||||
|
|
||||||
params['cookies'] = google_info['cookies']
|
params['cookies'] = google_info['cookies']
|
||||||
params['headers'].update(google_info['headers'])
|
params['headers'].update(google_info['headers'])
|
||||||
|
# this ua will allow getting ~50 results instead of 10. #1641
|
||||||
|
params['headers']['User-Agent'] = (
|
||||||
|
'NSTN/3.60.474802233.release Dalvik/2.1.0 (Linux; U; Android 12;' f' {google_info.get("country", "US")}) gzip'
|
||||||
|
)
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +95,6 @@ def response(resp):
|
|||||||
json_data = loads(resp.text[json_start:])
|
json_data = loads(resp.text[json_start:])
|
||||||
|
|
||||||
for item in json_data["ischj"].get("metadata", []):
|
for item in json_data["ischj"].get("metadata", []):
|
||||||
|
|
||||||
result_item = {
|
result_item = {
|
||||||
'url': item["result"]["referrer_url"],
|
'url': item["result"]["referrer_url"],
|
||||||
'title': item["result"]["page_title"],
|
'title': item["result"]["page_title"],
|
||||||
|
Loading…
Reference in New Issue
Block a user