summaryrefslogtreecommitdiff
path: root/searx/engines/blekko_images.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-02-09 10:47:40 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-02-09 10:47:40 +0100
commit67df3c516fc380d000f32d43ecb90c0fc32ca46a (patch)
tree0eb983532ab1542a9c0e1efd681604aa7346cd33 /searx/engines/blekko_images.py
parent5f801d7ea0ee1e4b4bec7f52c45ca3f601fc5cdc (diff)
parent7ac6361b51199ce8b208dcd6e8ba62ec4f652186 (diff)
Merge pull request #220 from pointhi/safesearch
Safesearch
Diffstat (limited to 'searx/engines/blekko_images.py')
-rw-r--r--searx/engines/blekko_images.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/searx/engines/blekko_images.py b/searx/engines/blekko_images.py
index 2bae9c35e..2e7ec904f 100644
--- a/searx/engines/blekko_images.py
+++ b/searx/engines/blekko_images.py
@@ -14,11 +14,17 @@ from urllib import urlencode
# engine dependent config
categories = ['images']
paging = True
+safesearch = True
# search-url
base_url = 'https://blekko.com'
search_url = '/api/images?{query}&c={c}'
+# safesearch definitions
+safesearch_types = {2: '1',
+ 1: '',
+ 0: '0'}
+
# do search-request
def request(query, params):
@@ -31,6 +37,12 @@ def request(query, params):
if params['pageno'] != 1:
params['url'] += '&page={pageno}'.format(pageno=(params['pageno']-1))
+ # let Blekko know we wan't have profiling
+ params['cookies']['tag_lesslogging'] = '1'
+
+ # parse safesearch argument
+ params['cookies']['safesearch'] = safesearch_types.get(params['safesearch'], '')
+
return params