duckduckgo_search.exceptions.DuckDuckGoSearchException
h9052300 opened this issue · comments
from duckduckgo_search import DDGS
with DDGS() as ddgs:
keywords = '蔡英文'
ddgs_news_gen = ddgs.news(
keywords,
region="zh-TW",
safesearch="Off",
timelimit="m",
)
for r in ddgs_news_gen:
print(r)
Traceback (most recent call last):
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 46, in _get_url
raise DuckDuckGoSearchException("Ratelimit")
duckduckgo_search.exceptions.DuckDuckGoSearchException: Ratelimit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\Desktop\Python Project\flask_view\yikogd\ddgoSearch.py", line 129, in <module>
for r in ddgs_news_gen:
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 508, in news
vqd = self._get_vqd(keywords)
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 54, in _get_vqd
resp = self._get_url("POST", "https://duckduckgo.com", data={"q": keywords})
File "C:\Users\user\Desktop\Python Project\flask_view\venv\lib\site-packages\duckduckgo_search\duckduckgo_search.py", line 50, in _get_url
raise DuckDuckGoSearchException(f"_get_url() {url} {type(ex).__name__}: {ex}")
duckduckgo_search.exceptions.DuckDuckGoSearchException: _get_url() https://duckduckgo.com DuckDuckGoSearchException: Ratelimit
But when searching with English keywords, everything works fine.
好像搜索中文都是有这个故障,包括:图片、视频 等接口,只有文本没报错
- region=
tw-tzh
for Taiwan https://github.com/deedy5/duckduckgo_search#regions, - apparently there were some problems on the site, because the code did cause an error, but then it worked properly.
@deedy5 I am encountering the same error for chinese text, including ddgs.text
.