This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<spanid="module-searx.engines.duckduckgo"></span><h2><aclass="toc-backref"href="#id2"role="doc-backlink">DuckDuckGo WEB</a><aclass="headerlink"href="#duckduckgo-web"title="Link to this heading">¶</a></h2>
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo.</span></span><spanclass="sig-name descname"><spanclass="pre">send_accept_language_header</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">True</span></em><aclass="headerlink"href="#searx.engines.duckduckgo.send_accept_language_header"title="Link to this definition">¶</a></dt>
<dd><p>DuckDuckGo-Lite tries to guess user’s preferred language from the HTTP
<codeclass="docutils literal notranslate"><spanclass="pre">Accept-Language</span></code>. Optional the user can select a region filter (but not a
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo.</span></span><spanclass="sig-name descname"><spanclass="pre">get_ddg_lang</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">eng_traits</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../enginelib.html#searx.enginelib.traits.EngineTraits"title="searx.enginelib.traits.EngineTraits"><spanclass="pre">EngineTraits</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">sxng_locale</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">default</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">'en_US'</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/duckduckgo.html#get_ddg_lang"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.duckduckgo.get_ddg_lang"title="Link to this definition">¶</a></dt>
<dd><p>Get DuckDuckGo’s language identifier from SearXNG’s locale.</p>
<p>DuckDuckGo defines its languages by region codes (see
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo.</span></span><spanclass="sig-name descname"><spanclass="pre">is_ddg_captcha</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">dom</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/duckduckgo.html#is_ddg_captcha"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.duckduckgo.is_ddg_captcha"title="Link to this definition">¶</a></dt>
<dd><p>In case of CAPTCHA ddg response its own <em>not a Robot</em> dialog and is not
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo.</span></span><spanclass="sig-name descname"><spanclass="pre">fetch_traits</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">engine_traits</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../enginelib.html#searx.enginelib.traits.EngineTraits"title="searx.enginelib.traits.EngineTraits"><spanclass="pre">EngineTraits</span></a></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/duckduckgo.html#fetch_traits"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.duckduckgo.fetch_traits"title="Link to this definition">¶</a></dt>
<dd><p>Fetch languages & regions from DuckDuckGo.</p>
DuckDuckGo’s language “Browsers preferred language” (<codeclass="docutils literal notranslate"><spanclass="pre">wt_WT</span></code>) makes no
sense in a SearXNG request since SearXNG’s <codeclass="docutils literal notranslate"><spanclass="pre">all</span></code> will not add a
<codeclass="docutils literal notranslate"><spanclass="pre">Accept-Language</span></code> HTTP header. The value in <codeclass="docutils literal notranslate"><spanclass="pre">engine_traits.all_locale</span></code>
is <codeclass="docutils literal notranslate"><spanclass="pre">wt-wt</span></code> (the region).</p>
<p>Beside regions DuckDuckGo also defines its languages by region codes. By
example these are the english languages in DuckDuckGo:</p>
<ulclass="simple">
<li><p>en_US</p></li>
<li><p>en_AU</p></li>
<li><p>en_CA</p></li>
<li><p>en_GB</p></li>
</ul>
<p>The function <aclass="reference internal"href="#searx.engines.duckduckgo.get_ddg_lang"title="searx.engines.duckduckgo.get_ddg_lang"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">get_ddg_lang</span></code></a> evaluates DuckDuckGo’s language from
SearXNG’s locale.</p>
</dd></dl>
<sectionid="duckduckgo-extra-images-videos-news">
<spanid="module-searx.engines.duckduckgo_extra"></span><h2><aclass="toc-backref"href="#id3"role="doc-backlink">DuckDuckGo Extra (images, videos, news)</a><aclass="headerlink"href="#duckduckgo-extra-images-videos-news"title="Link to this heading">¶</a></h2>
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo_extra.</span></span><spanclass="sig-name descname"><spanclass="pre">ddg_category</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">'images'</span></em><aclass="headerlink"href="#searx.engines.duckduckgo_extra.ddg_category"title="Link to this definition">¶</a></dt>
<dd><p>The category must be any of <codeclass="docutils literal notranslate"><spanclass="pre">images</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">videos</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">news</span></code></p>
</dd></dl>
<sectionid="duckduckgo-instant-answer-api">
<spanid="module-searx.engines.duckduckgo_definitions"></span><h2><aclass="toc-backref"href="#id4"role="doc-backlink">DuckDuckGo Instant Answer API</a><aclass="headerlink"href="#duckduckgo-instant-answer-api"title="Link to this heading">¶</a></h2>
<p>The <aclass="reference external"href="https://duckduckgo.com/api">DDG-API</a> 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.</p>
<p>As far we can say the <em>instant answers</em> 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.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo_definitions.</span></span><spanclass="sig-name descname"><spanclass="pre">is_broken_text</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">text</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/duckduckgo_definitions.html#is_broken_text"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.duckduckgo_definitions.is_broken_text"title="Link to this definition">¶</a></dt>
<dd><p>duckduckgo may return something like <codeclass="docutils literal notranslate"><spanclass="pre"><a</span><spanclass="pre">href="xxxx">http://somewhere</span><spanclass="pre">Related</span><spanclass="pre">website<a/></span></code></p>
<p>The href URL is broken, the “Related website” may contains some HTML.</p>
<p>The best solution seems to ignore these results.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">searx.engines.duckduckgo_definitions.</span></span><spanclass="sig-name descname"><spanclass="pre">area_to_str</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">area</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/searx/engines/duckduckgo_definitions.html#area_to_str"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#searx.engines.duckduckgo_definitions.area_to_str"title="Link to this definition">¶</a></dt>
<spanid="module-searx.engines.duckduckgo_weather"></span><h2><aclass="toc-backref"href="#id5"role="doc-backlink">DuckDuckGo Weather</a><aclass="headerlink"href="#duckduckgo-weather"title="Link to this heading">¶</a></h2>