[feat] duckduckgo images: add license filter support
This commit is contained in:
		
							parent
							
								
									2e97747bc0
								
							
						
					
					
						commit
						f39279a296
					
				| @ -44,6 +44,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_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
	
	Block a user