mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[fix] duckduckgo_definitions: fix relative image URL
ddg returns relative URL to https://duckduckgo.com/
This commit is contained in:
		
							parent
							
								
									cdceec1cbb
								
							
						
					
					
						commit
						28cc644f0a
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -10,7 +10,7 @@ DuckDuckGo (definitions) | |||
| """ | ||||
| 
 | ||||
| import json | ||||
| from urllib.parse import urlencode | ||||
| from urllib.parse import urlencode, urlparse, urljoin | ||||
| from lxml import html | ||||
| 
 | ||||
| from searx import logger | ||||
|  | @ -102,6 +102,8 @@ def response(resp): | |||
|     # image | ||||
|     image = search_res.get('Image') | ||||
|     image = None if image == '' else image | ||||
|     if image is not None and urlparse(image).netloc == '': | ||||
|         image = urljoin('https://duckduckgo.com', image) | ||||
| 
 | ||||
|     # urls | ||||
|     # Official website, Wikipedia page | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Alexandre Flament
						Alexandre Flament