Merge pull request #2356 from dalf/fix-ddd

[fix] duckduckgo_definitions: fix relative image URL
This commit is contained in:
Alexandre Flament 2020-12-07 10:16:53 +01:00 committed by GitHub
commit a458451d20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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