mirror of https://github.com/searxng/searxng.git
[enh] add safesearch to google_images
This commit is contained in:
parent
832ea60e3d
commit
10666fd7c0
|
@ -15,18 +15,25 @@ from json import loads
|
||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['images']
|
categories = ['images']
|
||||||
paging = True
|
paging = True
|
||||||
|
safesearch = True
|
||||||
|
|
||||||
# search-url
|
# search-url
|
||||||
url = 'https://ajax.googleapis.com/'
|
url = 'https://ajax.googleapis.com/'
|
||||||
search_url = url + 'ajax/services/search/images?v=1.0&start={offset}&rsz=large&safe=off&filter=off&{query}'
|
search_url = url + 'ajax/services/search/images?v=1.0&start={offset}&rsz=large&safe={safesearch}&filter=off&{query}'
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
offset = (params['pageno'] - 1) * 8
|
offset = (params['pageno'] - 1) * 8
|
||||||
|
|
||||||
|
if params['safesearch'] == 2:
|
||||||
|
safesearch = 'on'
|
||||||
|
else:
|
||||||
|
safesearch = 'off'
|
||||||
|
|
||||||
params['url'] = search_url.format(query=urlencode({'q': query}),
|
params['url'] = search_url.format(query=urlencode({'q': query}),
|
||||||
offset=offset)
|
offset=offset,
|
||||||
|
safesearch=safesearch)
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue