summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-08 22:15:25 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-08 22:15:25 +0100
commit10666fd7c03ac3e9ba6507d36f04181fb90ae466 (patch)
tree1a5a0ca5aaf53dae45f4a79e4e04c884fdab5b24
parent832ea60e3d19add2ffa857bc420ff33af83aac5c (diff)
downloadsearxng-10666fd7c03ac3e9ba6507d36f04181fb90ae466.tar.gz
searxng-10666fd7c03ac3e9ba6507d36f04181fb90ae466.zip
[enh] add safesearch to google_images
-rw-r--r--searx/engines/google_images.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index 092ae6639..31ad7e080 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -15,18 +15,25 @@ from json import loads
# engine dependent config
categories = ['images']
paging = True
+safesearch = True
# search-url
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
def request(query, params):
offset = (params['pageno'] - 1) * 8
+ if params['safesearch'] == 2:
+ safesearch = 'on'
+ else:
+ safesearch = 'off'
+
params['url'] = search_url.format(query=urlencode({'q': query}),
- offset=offset)
+ offset=offset,
+ safesearch=safesearch)
return params