diff options
Diffstat (limited to 'searx/engines/duckduckgo_images.py')
-rw-r--r-- | searx/engines/duckduckgo_images.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/searx/engines/duckduckgo_images.py b/searx/engines/duckduckgo_images.py index 438a8d54c..009f81cca 100644 --- a/searx/engines/duckduckgo_images.py +++ b/searx/engines/duckduckgo_images.py @@ -15,6 +15,7 @@ from json import loads from urllib.parse import urlencode +from searx.exceptions import SearxEngineAPIException from searx.engines.duckduckgo import get_region_code from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import from searx.poolrequests import get @@ -37,7 +38,7 @@ def get_vqd(query, headers): res = get(query_url, headers=headers) content = res.text if content.find('vqd=\'') == -1: - raise Exception('Request failed') + raise SearxEngineAPIException('Request failed') vqd = content[content.find('vqd=\'') + 5:] vqd = vqd[:vqd.find('\'')] return vqd @@ -71,10 +72,7 @@ def response(resp): results = [] content = resp.text - try: - res_json = loads(content) - except: - raise Exception('Cannot parse results') + res_json = loads(content) # parse results for result in res_json['results']: |