summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo_definitions.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-06 10:14:09 +0100
committerAlexandre Flament <alex@al-f.net>2020-12-06 10:14:09 +0100
commit28cc644f0ae4c9cbbdb372522633b68f25eca1a4 (patch)
treeb3b387f97d79e0d43bdb61f37f96a33aaf42a339 /searx/engines/duckduckgo_definitions.py
parentcdceec1cbb2ca894572396e0a68c2d09b0769231 (diff)
downloadsearxng-28cc644f0ae4c9cbbdb372522633b68f25eca1a4.tar.gz
searxng-28cc644f0ae4c9cbbdb372522633b68f25eca1a4.zip
[fix] duckduckgo_definitions: fix relative image URL
ddg returns relative URL to https://duckduckgo.com/
Diffstat (limited to 'searx/engines/duckduckgo_definitions.py')
-rw-r--r--searx/engines/duckduckgo_definitions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py
index 5a7649173..1d1c84b4b 100644
--- a/searx/engines/duckduckgo_definitions.py
+++ b/searx/engines/duckduckgo_definitions.py
@@ -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