Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
from duckduckgo_search import DDGS
with DDGS() as ddgs:
keywords = 'butterfly'
ddgs_images_gen = ddgs.images(
keywords,
region="wt-wt",
safesearch="off",
size=None,
color="Monochrome",
type_image=None,
layout=None,
license_image=None,
max_results=100,
)
for r in ddgs_images_gen:
print(r)
results in following error trace -
_Traceback (most recent call last):
File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 46, in _get_url
if _is_500_in_url(str(resp.url)) or resp.status_code == 403:
duckduckgo_search.exceptions.APIException: _get_url() https://duckduckgo.com/i.js 500 in url
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 15, in
File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 381, in images
license_image = f"license:{license_image}" if license_image else ""
File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 57, in _get_url
except httpx.HTTPError as ex:
duckduckgo_search.exceptions.DuckDuckGoSearchException: _get_url() https://duckduckgo.com/i.js APIException: _geturl() https://duckduckgo.com/i.js 500 in url
duckduckgo_search version. 3.9.10
Are DDG making changes or are there regular issues like this - I am thinking may have to use a different search engine
error returned when trying to run image search
duckduckgo_search.exceptions.DuckDuckGoSearchException: _get_url() https://duckduckgo.com/i.js APIException: _get_url() https://duckduckgo.com/i.js 500 in url
steps to reproduce -
from duckduckgo_search import DDGS with DDGS() as ddgs: keywords = 'butterfly' ddgs_images_gen = ddgs.images( keywords, region="wt-wt", safesearch="off", size=None, color="Monochrome", type_image=None, layout=None, license_image=None, max_results=100, ) for r in ddgs_images_gen: print(r)
results in following error trace -
_Traceback (most recent call last): File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 46, in _get_url if _is_500_in_url(str(resp.url)) or resp.status_code == 403: duckduckgo_search.exceptions.APIException: _get_url() https://duckduckgo.com/i.js 500 in url During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 15, in
File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 381, in images
license_image = f"license:{license_image}" if license_image else ""
File "/Users/keithnisbet/Bubblr/ew/ew-nlp/venv/lib/python3.9/site-packages/duckduckgo_search/duckduckgo_search.py", line 57, in _get_url
except httpx.HTTPError as ex:
duckduckgo_search.exceptions.DuckDuckGoSearchException: _get_url() https://duckduckgo.com/i.js APIException: _geturl() https://duckduckgo.com/i.js 500 in url
Are DDG making changes or are there regular issues like this - I am thinking may have to use a different search engine