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
927 stars 117 forks source link

for the first run its give you rate limit #203

Closed ALEXDINO7 closed 3 months ago

ALEXDINO7 commented 3 months ago

this is my used code

import pandas as pd from duckduckgo_search import DDGS

search_query = "dog" results = DDGS().text(keywords=search_query,region='wt-wt',safesearch= 'off',max_results=50) results_df = pd.DataFrame(results) results_df.to_csv('USA_Dogs.csv',index=False)

after first run I get this errors

C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\curl_cffi\aio.py:39: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required. Registering an additional selector thread for add_reader support. To avoid this warning use: asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

warnings.warn(PROACTOR_WARNING, RuntimeWarning) Traceback (most recent call last): File "c:\Users\dikacom\Desktop\DuckDuckGo API\shopify_stores.py", line 10, in results = DDGS().text(keywords=search_query,region='wt-wt',safesearch= 'off',max_results=50) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 50, in text return self._run_async_in_thread(super().text(*args, *kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 46, in _run_async_in_thread result = future.result() ^^^^^^^^^^^^^^^ File "C:\Users\dikacom\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 456, in result return self.get_result() ^^^^^^^^^^^^^^^^^^^ File "C:\Users\dikacom\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures_base.py", line 401, in get_result raise self._exception File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search_async.py", line 165, in text results = await self._text_api(keywords, region, safesearch, timelimit, max_results) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search_async.py", line 246, in _text_api await asyncio.gather(tasks) File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search_async.py", line 225, in _text_api_page resp_content = await self._aget_url("GET", "https://links.duckduckgo.com/d.js", params=payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dikacom\Desktop\DuckDuckGo API\env\Lib\site-packages\duckduckgo_search\duckduckgo_search_async.py", line 122, in _aget_url raise RatelimitException(f"{resp.url} {resp.status_code}") duckduckgo_search.exceptions.RatelimitException: https://links.duckduckgo.com/d.js?q=site%3Amyshopify.com+%27dog%27&kl=wt-wt&l=wt-wt&vqd=4-80309292398790847768408808690747059675&bing_market=wt-wt&a=ftsa&ex=-2&s=23 202

deedy5 commented 3 months ago

Something changed in the api, wait for the hotfix

deedy5 commented 3 months ago

Fixed in v5.2.1. Update pip install -U duckduckgo_search and check it out