mirror of https://github.com/searxng/searxng.git
[feat] duckduckgo images: add license filter support
This commit is contained in:
parent
d662a3dd24
commit
870fd2823c
|
@ -45,6 +45,7 @@ safesearch_cookies = {0: '-2', 1: None, 2: '1'}
|
||||||
safesearch_args = {0: '1', 1: None, 2: '1'}
|
safesearch_args = {0: '1', 1: None, 2: '1'}
|
||||||
|
|
||||||
search_path_map = {'images': 'i', 'videos': 'v', 'news': 'news'}
|
search_path_map = {'images': 'i', 'videos': 'v', 'news': 'news'}
|
||||||
|
license_map = {'public': 'Public', 'freetouse': 'Modify', 'commercial': ''}
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -59,12 +60,16 @@ def request(query, params):
|
||||||
eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)
|
eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)
|
||||||
eng_lang = get_ddg_lang(traits, params['searxng_locale'])
|
eng_lang = get_ddg_lang(traits, params['searxng_locale'])
|
||||||
|
|
||||||
|
f_arg = ''
|
||||||
|
if ddg_category == 'images' and params['license_filter']:
|
||||||
|
f_arg = 'license:' + license_map[params['license_filter']]
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
'q': query,
|
'q': query,
|
||||||
'o': 'json',
|
'o': 'json',
|
||||||
# 'u': 'bing',
|
# 'u': 'bing',
|
||||||
'l': eng_region,
|
'l': eng_region,
|
||||||
'f': ',,,,,',
|
'f': ',,,,,' + f_arg,
|
||||||
'vqd': vqd,
|
'vqd': vqd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue