From e7de9674b14c2ff06fac009274742819d6468138 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Sun, 8 Feb 2015 21:53:37 +0100 Subject: [enh] add safesearch functionality 2 = strict 1 = moderate 0 = none --- searx/engines/blekko_images.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'searx/engines/blekko_images.py') diff --git a/searx/engines/blekko_images.py b/searx/engines/blekko_images.py index 2bae9c35e..4fbb9b30f 100644 --- a/searx/engines/blekko_images.py +++ b/searx/engines/blekko_images.py @@ -14,11 +14,16 @@ 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 +36,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 -- cgit v1.2.3 From 832ea60e3d19add2ffa857bc420ff33af83aac5c Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Sun, 8 Feb 2015 22:01:24 +0100 Subject: [fix] pep8, tests --- searx/engines/blekko_images.py | 1 + 1 file changed, 1 insertion(+) (limited to 'searx/engines/blekko_images.py') diff --git a/searx/engines/blekko_images.py b/searx/engines/blekko_images.py index 4fbb9b30f..2e7ec904f 100644 --- a/searx/engines/blekko_images.py +++ b/searx/engines/blekko_images.py @@ -25,6 +25,7 @@ safesearch_types = {2: '1', 1: '', 0: '0'} + # do search-request def request(query, params): c = (params['pageno'] - 1) * 48 -- cgit v1.2.3