mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	add time range search for deviantart
This commit is contained in:
		
							parent
							
								
									e9a78f1434
								
							
						
					
					
						commit
						e7baf24ec1
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		|  | @ -21,10 +21,16 @@ from searx.engines.xpath import extract_text | ||||||
| # engine dependent config | # engine dependent config | ||||||
| categories = ['images'] | categories = ['images'] | ||||||
| paging = True | paging = True | ||||||
|  | time_range_support = True | ||||||
| 
 | 
 | ||||||
| # search-url | # search-url | ||||||
| base_url = 'https://www.deviantart.com/' | base_url = 'https://www.deviantart.com/' | ||||||
| search_url = base_url + 'browse/all/?offset={offset}&{query}' | search_url = base_url + 'browse/all/?offset={offset}&{query}' | ||||||
|  | time_range_url = '&order={range}' | ||||||
|  | 
 | ||||||
|  | time_range_dict = {'day': 11, | ||||||
|  |                    'week': 14, | ||||||
|  |                    'month': 15} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # do search-request | # do search-request | ||||||
|  | @ -33,6 +39,8 @@ def request(query, params): | ||||||
| 
 | 
 | ||||||
|     params['url'] = search_url.format(offset=offset, |     params['url'] = search_url.format(offset=offset, | ||||||
|                                       query=urlencode({'q': query})) |                                       query=urlencode({'q': query})) | ||||||
|  |     if params['time_range']: | ||||||
|  |         params['url'] += time_range_url.format(range=time_range_dict[params['time_range']]) | ||||||
| 
 | 
 | ||||||
|     return params |     return params | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Noemi Vanyi
						Noemi Vanyi