mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[enh] add safesearch functionality
2 = strict 1 = moderate 0 = none
This commit is contained in:
parent
dd4686a388
commit
e7de9674b1
7 changed files with 66 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue