deedy5 / duckduckgo_search

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.
MIT License
932 stars 117 forks source link

DDG gives me 403 periodically. #100

Closed pcarinhas closed 1 year ago

pcarinhas commented 1 year ago

I can only do a few queries until I get a 403 on my dev box. Is there anything I should do I avoid that? If I wait for a period it again allows me to continue.

Using their 403 link, it works in the browser so maybe they don't want non-browser access. For example:

This failed:

ddgs news -k "ukraine war" -m 11

But this worked:

https://duckduckgo.com/news.js?l=wt-wt&o=json&noamp=1&q=ukraine%20war&vqd=4-332504019714920169446792928607979845974&p=-1&df=&s=0

deedy5 commented 1 year ago

Is there anything I should do I avoid that? Use a proxy or call the function less often

pcarinhas commented 1 year ago

Can I extract the vqd from the response and use that in subsequent calls? That seems to work with curl. It looks like you already extract and include vqd in the payload, so I'm unsure how their direct link even works in the browser.. I don't really want to use a proxy. Can you recommend a way without proxy?