You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wikipedia engine builds invalid URL for region="wt-wt" (wt.wikipedia.org does not exist) #417
I have the latest version. (Check: ddgs version. Update: pip install -U ddgs)
I tried reinstalling the library. (pip install -I ddgs)
I tried using a proxy
Describe the bug
When backend="auto" is used and the wikipedia engine is selected, it constructs an invalid Wikipedia URL for the region="wt-wt" (worldwide, no regional bias) parameter. This causes a ConnectionError on every search because https://wt.wikipedia.org does not exist.
Root cause — ddgs/engines/wikipedia.py, build_payload, line 35:
_country, lang=region.lower().split("-")
For region="wt-wt" (DuckDuckGo's "no region" sentinel), this produces lang = "wt", which is not a valid ISO 639 language code. The engine then builds:
That domain does not exist, causing every call with backend="auto" to fail when the wikipedia engine is chosen.
Steps to reproduce the problem:
fromddgsimportDDGSresults=DDGS().text(
"python programming",
region="wt-wt", # worldwide, no regional biassafesearch="off",
backend="auto", # picks wikipedia enginemax_results=5,
)
Expected: results returned from a working backend Actual:ConnectionError — cannot connect to https://wt.wikipedia.org
Suggested fix: In wikipedia.py → build_payload, fall back to "en" when lang is not a recognised Wikipedia language code:
_country, lang=region.lower().split("-")
iflang=="wt"orlen(lang) >3: # wt-wt is DDG's "worldwide" sentinellang="en"
Workaround (current): Pin backend="duckduckgo" explicitly to skip the wikipedia engine entirely.
Specify this information
OS: Ubuntu 24.04.4 LTS on WSL2 (Linux 5.15.167.4-microsoft-standard-WSL2)
Activity
deedy5 commentedon Apr 6, 2026
"wt-wt" is not exist in ddgs
GPT Researcher wrapper: fail closed on a report written from zero sou…
GPT Researcher wrapper: fail closed on a report written from zero sou…