DuckDuckGo Engines

DuckDuckGo Lite

searx.engines.duckduckgo.cache_vqd(query, value)[source]

Caches a vqd value from a query.

The vqd value depends on the query string and is needed for the follow up pages or the images loaded by a XMLHttpRequest:

  • DuckDuckGo Web:…&vqd=…

  • DuckDuckGo Images:…&vqd=…

searx.engines.duckduckgo.fetch_traits(engine_traits: EngineTraits)[source]

Fetch languages & regions from DuckDuckGo.

SearXNG’s all locale maps DuckDuckGo’s “Alle regions” (wt-wt). DuckDuckGo’s language “Browsers prefered language” (wt_WT) makes no sense in a SearXNG request since SearXNG’s all will not add a Accept-Language HTTP header. The value in engine_traits.all_locale is wt-wt (the region).

Beside regions DuckDuckGo also defines its languages by region codes. By example these are the english languages in DuckDuckGo:

  • en_US

  • en_AU

  • en_CA

  • en_GB

The function get_ddg_lang evaluates DuckDuckGo’s language from SearXNG’s locale.

searx.engines.duckduckgo.get_ddg_lang(eng_traits: EngineTraits, sxng_locale, default='en_US')[source]

Get DuckDuckGo’s language identifier from SearXNG’s locale.

DuckDuckGo defines its languages by region codes (see fetch_traits).

To get region and language of a DDG service use:

It might confuse, but the l value of the cookie is what SearXNG calls the region:

# !ddi paris :es-AR --> {'ad': 'es_AR', 'ah': 'ar-es', 'l': 'ar-es'}
params['cookies']['ad'] = eng_lang
params['cookies']['ah'] = eng_region
params['cookies']['l'] = eng_region


DDG-lite does not offer a language selection to the user, only a region can be selected by the user (eng_region from the example above). DDG-lite stores the selected region in a cookie:

params['cookies']['kl'] = eng_region  # 'ar-es'

Returns the vqd that fits to the query. If there is no vqd cached (cache_vqd) the query is sent to DDG to get a vqd value from the response.

searx.engines.duckduckgo.send_accept_language_header = True

DuckDuckGo-Lite tries to guess user’s prefered language from the HTTP Accept-Language. Optional the user can select a region filter (but not a language).

DuckDuckGo Images

DuckDuckGo Instant Answer API

The DDG-API is no longer documented but from reverse engineering we can see that some services (e.g. instant answers) still in use from the DDG search engine.

As far we can say the instant answers API does not support languages, or at least we could not find out how language support should work. It seems that most of the features are based on English terms.


parse {'unit': '', 'amount': '+20.99'}


duckduckgo may return something like <a href="xxxx">http://somewhere Related website<a/>

The href URL is broken, the “Related website” may contains some HTML.

The best solution seems to ignore these results.

DuckDuckGo Weather