Open k-nowicki opened 2 years ago
I did two things and i'm not sure what worked, but i was able to download images:
In here: https://github.com/JorgePoblete/DuckDuckGoImages/issues/3#issuecomment-1218865679, the owner told the problem was the user agent:
the example is correct, the problem was that the user agent used is outdated and duckduck go blocked the requests, the user agent has been updated in v2.0.8, there the example should work again
So, i opened my Firefox and consulted my user-agent:
Then, i opened the "DuckDuckGoImages.py" and modify the line 150 with my user-agent:
The other thing i did was a search on duckduckgo via firefox https://github.com/JorgePoblete/DuckDuckGoImages/issues/3#issuecomment-1246179520:
it seems that duckduckgo has made a change on how it works, for some reason you need to actually made a search on duckduckgo via your browser to made the example and all the other features work for some time, i'll be investigating what was this change to upload a fix, but in the meantine, before running your code, make a search on your browser on duckduckgo.
it seems that duckduckgo has made a change on how it works, for some reason you need to actually made a search on duckduckgo via your browser to made the example and all the other features work for some time, i'll be investigating what was this change to upload a fix, but in the meantine, before running your code, make a search on your browser on duckduckgo.
What worked for me was setting my browser's user agent and also using a new IP (in my case that meant rebooting my router, but I guess using a VPN should work).
Hi, to put it into a lib was a good idea, but I have the same problem. Tried all these things and still don't work! Shows the same error-message ValueError as like @k-nowicki. I'm quiet sure that ddg changed something to complicate auto-download. I see that this issue exists since end of last year.
Is there meanwhile an Update at work? regards jori
I've tried and get this same error even after updating the user-agent string.
Hi, no change from my side either. Posted this problem on diverse pages. The only thing I got was cheap shots but no constructive help . . .
Hi, same mistake
Code:
import DuckDuckGoImages as ddg
ddg.download('kittens')
Result: ValueError: not enough values to unpack (expected 2, got 0)
Hi, same error
ValueError: not enough values to unpack (expected 2, got 0)
Seems that Duck changed something, and any query ends up with this error:
Traceback (most recent call last): File "", line 1, in
File "/home/k/lib/python3.9/site-packages/DuckDuckGoImages.py", line 57, in download
urls = get_image_urls(query, license, safe_search)
File "/home/k/lib/python3.9/site-packages/DuckDuckGoImages.py", line 106, in get_image_urls
return _fetch_search_urls(query, token, license, safe_search)
File "/home/k/lib/python3.9/site-packages/DuckDuckGoImages.py", line 136, in _fetch_search_urls
_urls, next = _get_urls(f"{URL}i.js", query, what)
ValueError: not enough values to unpack (expected 2, got 0)
Version: 2.0.8