summaryrefslogtreecommitdiff
path: root/_modules/searx/search/processors
diff options
context:
space:
mode:
Diffstat (limited to '_modules/searx/search/processors')
-rw-r--r--_modules/searx/search/processors/abstract.html311
-rw-r--r--_modules/searx/search/processors/offline.html137
-rw-r--r--_modules/searx/search/processors/online.html350
-rw-r--r--_modules/searx/search/processors/online_currency.html187
-rw-r--r--_modules/searx/search/processors/online_dictionary.html174
-rw-r--r--_modules/searx/search/processors/online_url_search.html159
6 files changed, 1318 insertions, 0 deletions
diff --git a/_modules/searx/search/processors/abstract.html b/_modules/searx/search/processors/abstract.html
new file mode 100644
index 000000000..c25785a8f
--- /dev/null
+++ b/_modules/searx/search/processors/abstract.html
@@ -0,0 +1,311 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.abstract &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.abstract</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.abstract</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Abstract base classes for engine request processors.</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">threading</span>
+<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">abstractmethod</span><span class="p">,</span> <span class="n">ABC</span>
+<span class="kn">from</span> <span class="nn">timeit</span> <span class="kn">import</span> <span class="n">default_timer</span>
+<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">Union</span>
+
+<span class="kn">from</span> <span class="nn">searx</span> <span class="kn">import</span> <span class="n">settings</span><span class="p">,</span> <span class="n">logger</span>
+<span class="kn">from</span> <span class="nn">searx.engines</span> <span class="kn">import</span> <span class="n">engines</span>
+<span class="kn">from</span> <span class="nn">searx.network</span> <span class="kn">import</span> <span class="n">get_time_for_thread</span><span class="p">,</span> <span class="n">get_network</span>
+<span class="kn">from</span> <span class="nn">searx.metrics</span> <span class="kn">import</span> <span class="n">histogram_observe</span><span class="p">,</span> <span class="n">counter_inc</span><span class="p">,</span> <span class="n">count_exception</span><span class="p">,</span> <span class="n">count_error</span>
+<span class="kn">from</span> <span class="nn">searx.exceptions</span> <span class="kn">import</span> <span class="n">SearxEngineAccessDeniedException</span><span class="p">,</span> <span class="n">SearxEngineResponseException</span>
+<span class="kn">from</span> <span class="nn">searx.utils</span> <span class="kn">import</span> <span class="n">get_engine_from_settings</span>
+
+<span class="n">logger</span> <span class="o">=</span> <span class="n">logger</span><span class="o">.</span><span class="n">getChild</span><span class="p">(</span><span class="s1">&#39;searx.search.processor&#39;</span><span class="p">)</span>
+<span class="n">SUSPENDED_STATUS</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="s1">&#39;SuspendedStatus&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
+
+
+<div class="viewcode-block" id="SuspendedStatus">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.abstract.SuspendedStatus">[docs]</a>
+<span class="k">class</span> <span class="nc">SuspendedStatus</span><span class="p">:</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class to handle suspend state.&quot;&quot;&quot;</span>
+
+ <span class="vm">__slots__</span> <span class="o">=</span> <span class="s1">&#39;suspend_end_time&#39;</span><span class="p">,</span> <span class="s1">&#39;suspend_reason&#39;</span><span class="p">,</span> <span class="s1">&#39;continuous_errors&#39;</span><span class="p">,</span> <span class="s1">&#39;lock&#39;</span>
+
+ <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">lock</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Lock</span><span class="p">()</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">continuous_errors</span> <span class="o">=</span> <span class="mi">0</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_end_time</span> <span class="o">=</span> <span class="mi">0</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_reason</span> <span class="o">=</span> <span class="kc">None</span>
+
+ <span class="nd">@property</span>
+ <span class="k">def</span> <span class="nf">is_suspended</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">suspend_end_time</span> <span class="o">&gt;=</span> <span class="n">default_timer</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">suspend</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">suspended_time</span><span class="p">,</span> <span class="n">suspend_reason</span><span class="p">):</span>
+ <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
+ <span class="c1"># update continuous_errors / suspend_end_time</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">continuous_errors</span> <span class="o">+=</span> <span class="mi">1</span>
+ <span class="k">if</span> <span class="n">suspended_time</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="n">suspended_time</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span>
+ <span class="n">settings</span><span class="p">[</span><span class="s1">&#39;search&#39;</span><span class="p">][</span><span class="s1">&#39;max_ban_time_on_fail&#39;</span><span class="p">],</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">continuous_errors</span> <span class="o">*</span> <span class="n">settings</span><span class="p">[</span><span class="s1">&#39;search&#39;</span><span class="p">][</span><span class="s1">&#39;ban_time_on_fail&#39;</span><span class="p">],</span>
+ <span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_end_time</span> <span class="o">=</span> <span class="n">default_timer</span><span class="p">()</span> <span class="o">+</span> <span class="n">suspended_time</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_reason</span> <span class="o">=</span> <span class="n">suspend_reason</span>
+ <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s1">&#39;Suspend for </span><span class="si">%i</span><span class="s1"> seconds&#39;</span><span class="p">,</span> <span class="n">suspended_time</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">resume</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
+ <span class="c1"># reset the suspend variables</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">continuous_errors</span> <span class="o">=</span> <span class="mi">0</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_end_time</span> <span class="o">=</span> <span class="mi">0</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspend_reason</span> <span class="o">=</span> <span class="kc">None</span></div>
+
+
+
+<div class="viewcode-block" id="EngineProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.abstract.EngineProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">EngineProcessor</span><span class="p">(</span><span class="n">ABC</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Base classes used for all types of request processors.&quot;&quot;&quot;</span>
+
+ <span class="vm">__slots__</span> <span class="o">=</span> <span class="s1">&#39;engine&#39;</span><span class="p">,</span> <span class="s1">&#39;engine_name&#39;</span><span class="p">,</span> <span class="s1">&#39;lock&#39;</span><span class="p">,</span> <span class="s1">&#39;suspended_status&#39;</span><span class="p">,</span> <span class="s1">&#39;logger&#39;</span>
+
+ <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">engine</span><span class="p">,</span> <span class="n">engine_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine</span> <span class="o">=</span> <span class="n">engine</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span> <span class="o">=</span> <span class="n">engine_name</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span> <span class="o">=</span> <span class="n">engines</span><span class="p">[</span><span class="n">engine_name</span><span class="p">]</span><span class="o">.</span><span class="n">logger</span>
+ <span class="n">key</span> <span class="o">=</span> <span class="n">get_network</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">)</span>
+ <span class="n">key</span> <span class="o">=</span> <span class="nb">id</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="k">if</span> <span class="n">key</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspended_status</span> <span class="o">=</span> <span class="n">SUSPENDED_STATUS</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">SuspendedStatus</span><span class="p">())</span>
+
+ <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">init</span><span class="p">(</span><span class="n">get_engine_from_settings</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">))</span>
+ <span class="k">except</span> <span class="n">SearxEngineResponseException</span> <span class="k">as</span> <span class="n">exc</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s1">&#39;Fail to initialize // </span><span class="si">%s</span><span class="s1">&#39;</span><span class="p">,</span> <span class="n">exc</span><span class="p">)</span>
+ <span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;Fail to initialize&#39;</span><span class="p">)</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s1">&#39;Initialized&#39;</span><span class="p">)</span>
+
+ <span class="nd">@property</span>
+ <span class="k">def</span> <span class="nf">has_initialize_function</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;init&#39;</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">handle_exception</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">exception_or_message</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
+ <span class="c1"># update result_container</span>
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exception_or_message</span><span class="p">,</span> <span class="ne">BaseException</span><span class="p">):</span>
+ <span class="n">exception_class</span> <span class="o">=</span> <span class="n">exception_or_message</span><span class="o">.</span><span class="vm">__class__</span>
+ <span class="n">module_name</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">exception_class</span><span class="p">,</span> <span class="s1">&#39;__module__&#39;</span><span class="p">,</span> <span class="s1">&#39;builtins&#39;</span><span class="p">)</span>
+ <span class="n">module_name</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> <span class="k">if</span> <span class="n">module_name</span> <span class="o">==</span> <span class="s1">&#39;builtins&#39;</span> <span class="k">else</span> <span class="n">module_name</span> <span class="o">+</span> <span class="s1">&#39;.&#39;</span>
+ <span class="n">error_message</span> <span class="o">=</span> <span class="n">module_name</span> <span class="o">+</span> <span class="n">exception_class</span><span class="o">.</span><span class="vm">__qualname__</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">error_message</span> <span class="o">=</span> <span class="n">exception_or_message</span>
+ <span class="n">result_container</span><span class="o">.</span><span class="n">add_unresponsive_engine</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">error_message</span><span class="p">)</span>
+ <span class="c1"># metrics</span>
+ <span class="n">counter_inc</span><span class="p">(</span><span class="s1">&#39;engine&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="s1">&#39;search&#39;</span><span class="p">,</span> <span class="s1">&#39;count&#39;</span><span class="p">,</span> <span class="s1">&#39;error&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exception_or_message</span><span class="p">,</span> <span class="ne">BaseException</span><span class="p">):</span>
+ <span class="n">count_exception</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">exception_or_message</span><span class="p">)</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">count_error</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">exception_or_message</span><span class="p">)</span>
+ <span class="c1"># suspend the engine ?</span>
+ <span class="k">if</span> <span class="n">suspend</span><span class="p">:</span>
+ <span class="n">suspended_time</span> <span class="o">=</span> <span class="kc">None</span>
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exception_or_message</span><span class="p">,</span> <span class="n">SearxEngineAccessDeniedException</span><span class="p">):</span>
+ <span class="n">suspended_time</span> <span class="o">=</span> <span class="n">exception_or_message</span><span class="o">.</span><span class="n">suspended_time</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspended_status</span><span class="o">.</span><span class="n">suspend</span><span class="p">(</span><span class="n">suspended_time</span><span class="p">,</span> <span class="n">error_message</span><span class="p">)</span> <span class="c1"># pylint: disable=no-member</span>
+
+ <span class="k">def</span> <span class="nf">_extend_container_basic</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">search_results</span><span class="p">):</span>
+ <span class="c1"># update result_container</span>
+ <span class="n">result_container</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">search_results</span><span class="p">)</span>
+ <span class="n">engine_time</span> <span class="o">=</span> <span class="n">default_timer</span><span class="p">()</span> <span class="o">-</span> <span class="n">start_time</span>
+ <span class="n">page_load_time</span> <span class="o">=</span> <span class="n">get_time_for_thread</span><span class="p">()</span>
+ <span class="n">result_container</span><span class="o">.</span><span class="n">add_timing</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">engine_time</span><span class="p">,</span> <span class="n">page_load_time</span><span class="p">)</span>
+ <span class="c1"># metrics</span>
+ <span class="n">counter_inc</span><span class="p">(</span><span class="s1">&#39;engine&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="s1">&#39;search&#39;</span><span class="p">,</span> <span class="s1">&#39;count&#39;</span><span class="p">,</span> <span class="s1">&#39;successful&#39;</span><span class="p">)</span>
+ <span class="n">histogram_observe</span><span class="p">(</span><span class="n">engine_time</span><span class="p">,</span> <span class="s1">&#39;engine&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="s1">&#39;time&#39;</span><span class="p">,</span> <span class="s1">&#39;total&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">page_load_time</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="n">histogram_observe</span><span class="p">(</span><span class="n">page_load_time</span><span class="p">,</span> <span class="s1">&#39;engine&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="s1">&#39;time&#39;</span><span class="p">,</span> <span class="s1">&#39;http&#39;</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">extend_container</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">search_results</span><span class="p">):</span>
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">threading</span><span class="o">.</span><span class="n">current_thread</span><span class="p">(),</span> <span class="s1">&#39;_timeout&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="c1"># the main thread is not waiting anymore</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="s1">&#39;timeout&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="c1"># check if the engine accepted the request</span>
+ <span class="k">if</span> <span class="n">search_results</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">_extend_container_basic</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">search_results</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">suspended_status</span><span class="o">.</span><span class="n">resume</span><span class="p">()</span>
+
+ <span class="k">def</span> <span class="nf">extend_container_if_suspended</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result_container</span><span class="p">):</span>
+ <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">suspended_status</span><span class="o">.</span><span class="n">is_suspended</span><span class="p">:</span>
+ <span class="n">result_container</span><span class="o">.</span><span class="n">add_unresponsive_engine</span><span class="p">(</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">suspended_status</span><span class="o">.</span><span class="n">suspend_reason</span><span class="p">,</span> <span class="n">suspended</span><span class="o">=</span><span class="kc">True</span>
+ <span class="p">)</span>
+ <span class="k">return</span> <span class="kc">True</span>
+ <span class="k">return</span> <span class="kc">False</span>
+
+<div class="viewcode-block" id="EngineProcessor.get_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.abstract.EngineProcessor.get_params">[docs]</a>
+ <span class="k">def</span> <span class="nf">get_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a set of (see :ref:`request params &lt;engine request arguments&gt;`) or</span>
+<span class="sd"> ``None`` if request is not supported.</span>
+
+<span class="sd"> Not supported conditions (``None`` is returned):</span>
+
+<span class="sd"> - A page-number &gt; 1 when engine does not support paging.</span>
+<span class="sd"> - A time range when the engine does not support time range.</span>
+<span class="sd"> &quot;&quot;&quot;</span>
+ <span class="c1"># if paging is not supported, skip</span>
+ <span class="k">if</span> <span class="n">search_query</span><span class="o">.</span><span class="n">pageno</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">paging</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="c1"># if max page is reached, skip</span>
+ <span class="n">max_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">max_page</span> <span class="ow">or</span> <span class="n">settings</span><span class="p">[</span><span class="s1">&#39;search&#39;</span><span class="p">][</span><span class="s1">&#39;max_page&#39;</span><span class="p">]</span>
+ <span class="k">if</span> <span class="n">max_page</span> <span class="ow">and</span> <span class="n">max_page</span> <span class="o">&lt;</span> <span class="n">search_query</span><span class="o">.</span><span class="n">pageno</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="c1"># if time_range is not supported, skip</span>
+ <span class="k">if</span> <span class="n">search_query</span><span class="o">.</span><span class="n">time_range</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">time_range_support</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;category&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">engine_category</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;pageno&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">pageno</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;safesearch&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">safesearch</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;time_range&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">time_range</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;engine_data&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">engine_data</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="p">{})</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;searxng_locale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">lang</span>
+
+ <span class="c1"># deprecated / vintage --&gt; use params[&#39;searxng_locale&#39;]</span>
+ <span class="c1">#</span>
+ <span class="c1"># Conditions related to engine&#39;s traits are implemented in engine.traits</span>
+ <span class="c1"># module. Don&#39;t do &#39;locale&#39; decisions here in the abstract layer of the</span>
+ <span class="c1"># search processor, just pass the value from user&#39;s choice unchanged to</span>
+ <span class="c1"># the engine request.</span>
+
+ <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;language&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">language</span><span class="p">:</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;language&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">language</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;language&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">lang</span>
+
+ <span class="k">return</span> <span class="n">params</span></div>
+
+
+ <span class="nd">@abstractmethod</span>
+ <span class="k">def</span> <span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">timeout_limit</span><span class="p">):</span>
+ <span class="k">pass</span>
+
+ <span class="k">def</span> <span class="nf">get_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">tests</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;tests&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">tests</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="n">tests</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;additional_tests&#39;</span><span class="p">,</span> <span class="p">{})</span>
+ <span class="n">tests</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_default_tests</span><span class="p">())</span>
+ <span class="k">return</span> <span class="n">tests</span>
+
+ <span class="k">def</span> <span class="nf">get_default_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="k">return</span> <span class="p">{}</span></div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/_modules/searx/search/processors/offline.html b/_modules/searx/search/processors/offline.html
new file mode 100644
index 000000000..a08dc7cd7
--- /dev/null
+++ b/_modules/searx/search/processors/offline.html
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.offline &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.offline</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.offline</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Processors for engine-type: ``offline``</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">from</span> <span class="nn">.abstract</span> <span class="kn">import</span> <span class="n">EngineProcessor</span>
+
+
+<div class="viewcode-block" id="OfflineProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.offline.OfflineProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">OfflineProcessor</span><span class="p">(</span><span class="n">EngineProcessor</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Processor class used by ``offline`` engines&quot;&quot;&quot;</span>
+
+ <span class="n">engine_type</span> <span class="o">=</span> <span class="s1">&#39;offline&#39;</span>
+
+ <span class="k">def</span> <span class="nf">_search_basic</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">timeout_limit</span><span class="p">):</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="n">search_results</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_search_basic</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">extend_container</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">search_results</span><span class="p">)</span>
+ <span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="c1"># do not record the error</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;engine </span><span class="si">{0}</span><span class="s1"> : invalid input : </span><span class="si">{1}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">e</span><span class="p">))</span>
+ <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;engine </span><span class="si">{0}</span><span class="s1"> : exception : </span><span class="si">{1}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span> <span class="n">e</span><span class="p">))</span></div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/_modules/searx/search/processors/online.html b/_modules/searx/search/processors/online.html
new file mode 100644
index 000000000..6278818af
--- /dev/null
+++ b/_modules/searx/search/processors/online.html
@@ -0,0 +1,350 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.online &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.online</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.online</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Processors for engine-type: ``online``</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c1"># pylint: disable=use-dict-literal</span>
+
+<span class="kn">from</span> <span class="nn">timeit</span> <span class="kn">import</span> <span class="n">default_timer</span>
+<span class="kn">import</span> <span class="nn">asyncio</span>
+<span class="kn">import</span> <span class="nn">ssl</span>
+<span class="kn">import</span> <span class="nn">httpx</span>
+
+<span class="kn">import</span> <span class="nn">searx.network</span>
+<span class="kn">from</span> <span class="nn">searx.utils</span> <span class="kn">import</span> <span class="n">gen_useragent</span>
+<span class="kn">from</span> <span class="nn">searx.exceptions</span> <span class="kn">import</span> <span class="p">(</span>
+ <span class="n">SearxEngineAccessDeniedException</span><span class="p">,</span>
+ <span class="n">SearxEngineCaptchaException</span><span class="p">,</span>
+ <span class="n">SearxEngineTooManyRequestsException</span><span class="p">,</span>
+<span class="p">)</span>
+<span class="kn">from</span> <span class="nn">searx.metrics.error_recorder</span> <span class="kn">import</span> <span class="n">count_error</span>
+<span class="kn">from</span> <span class="nn">.abstract</span> <span class="kn">import</span> <span class="n">EngineProcessor</span>
+
+
+<div class="viewcode-block" id="default_request_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online.default_request_params">[docs]</a>
+<span class="k">def</span> <span class="nf">default_request_params</span><span class="p">():</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Default request parameters for ``online`` engines.&quot;&quot;&quot;</span>
+ <span class="k">return</span> <span class="p">{</span>
+ <span class="c1"># fmt: off</span>
+ <span class="s1">&#39;method&#39;</span><span class="p">:</span> <span class="s1">&#39;GET&#39;</span><span class="p">,</span>
+ <span class="s1">&#39;headers&#39;</span><span class="p">:</span> <span class="p">{},</span>
+ <span class="s1">&#39;data&#39;</span><span class="p">:</span> <span class="p">{},</span>
+ <span class="s1">&#39;url&#39;</span><span class="p">:</span> <span class="s1">&#39;&#39;</span><span class="p">,</span>
+ <span class="s1">&#39;cookies&#39;</span><span class="p">:</span> <span class="p">{},</span>
+ <span class="s1">&#39;auth&#39;</span><span class="p">:</span> <span class="kc">None</span>
+ <span class="c1"># fmt: on</span>
+ <span class="p">}</span></div>
+
+
+
+<div class="viewcode-block" id="OnlineProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online.OnlineProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">OnlineProcessor</span><span class="p">(</span><span class="n">EngineProcessor</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Processor class for ``online`` engines.&quot;&quot;&quot;</span>
+
+ <span class="n">engine_type</span> <span class="o">=</span> <span class="s1">&#39;online&#39;</span>
+
+ <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="c1"># set timeout for all HTTP requests</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">set_timeout_for_thread</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">timeout</span><span class="p">,</span> <span class="n">start_time</span><span class="o">=</span><span class="n">default_timer</span><span class="p">())</span>
+ <span class="c1"># reset the HTTP total time</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">reset_time_for_thread</span><span class="p">()</span>
+ <span class="c1"># set the network</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">set_context_network_name</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">)</span>
+ <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span>
+
+<div class="viewcode-block" id="OnlineProcessor.get_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online.OnlineProcessor.get_params">[docs]</a>
+ <span class="k">def</span> <span class="nf">get_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a set of :ref:`request params &lt;engine request online&gt;` or ``None``</span>
+<span class="sd"> if request is not supported.</span>
+<span class="sd"> &quot;&quot;&quot;</span>
+ <span class="n">params</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_params</span><span class="p">(</span><span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">params</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="c1"># add default params</span>
+ <span class="n">params</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">default_request_params</span><span class="p">())</span>
+
+ <span class="c1"># add an user agent</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;headers&#39;</span><span class="p">][</span><span class="s1">&#39;User-Agent&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gen_useragent</span><span class="p">()</span>
+
+ <span class="c1"># add Accept-Language header</span>
+ <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">send_accept_language_header</span> <span class="ow">and</span> <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="p">:</span>
+ <span class="n">ac_lang</span> <span class="o">=</span> <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="o">.</span><span class="n">language</span>
+ <span class="k">if</span> <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="o">.</span><span class="n">territory</span><span class="p">:</span>
+ <span class="n">ac_lang</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">,</span><span class="si">%s</span><span class="s2">;q=0.9,*;q=0.5&quot;</span> <span class="o">%</span> <span class="p">(</span>
+ <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="o">.</span><span class="n">language</span><span class="p">,</span>
+ <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="o">.</span><span class="n">territory</span><span class="p">,</span>
+ <span class="n">search_query</span><span class="o">.</span><span class="n">locale</span><span class="o">.</span><span class="n">language</span><span class="p">,</span>
+ <span class="p">)</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;headers&#39;</span><span class="p">][</span><span class="s1">&#39;Accept-Language&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ac_lang</span>
+
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s1">&#39;HTTP Accept-Language: </span><span class="si">%s</span><span class="s1">&#39;</span><span class="p">,</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;headers&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;Accept-Language&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">))</span>
+ <span class="k">return</span> <span class="n">params</span></div>
+
+
+ <span class="k">def</span> <span class="nf">_send_http_request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
+ <span class="c1"># create dictionary which contain all</span>
+ <span class="c1"># information about the request</span>
+ <span class="n">request_args</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">headers</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;headers&#39;</span><span class="p">],</span> <span class="n">cookies</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;cookies&#39;</span><span class="p">],</span> <span class="n">auth</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;auth&#39;</span><span class="p">])</span>
+
+ <span class="c1"># verify</span>
+ <span class="c1"># if not None, it overrides the verify value defined in the network.</span>
+ <span class="c1"># use False to accept any server certificate</span>
+ <span class="c1"># use a path to file to specify a server certificate</span>
+ <span class="n">verify</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;verify&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">verify</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="n">request_args</span><span class="p">[</span><span class="s1">&#39;verify&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;verify&#39;</span><span class="p">]</span>
+
+ <span class="c1"># max_redirects</span>
+ <span class="n">max_redirects</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;max_redirects&#39;</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">max_redirects</span><span class="p">:</span>
+ <span class="n">request_args</span><span class="p">[</span><span class="s1">&#39;max_redirects&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">max_redirects</span>
+
+ <span class="c1"># allow_redirects</span>
+ <span class="k">if</span> <span class="s1">&#39;allow_redirects&#39;</span> <span class="ow">in</span> <span class="n">params</span><span class="p">:</span>
+ <span class="n">request_args</span><span class="p">[</span><span class="s1">&#39;allow_redirects&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;allow_redirects&#39;</span><span class="p">]</span>
+
+ <span class="c1"># soft_max_redirects</span>
+ <span class="n">soft_max_redirects</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;soft_max_redirects&#39;</span><span class="p">,</span> <span class="n">max_redirects</span> <span class="ow">or</span> <span class="mi">0</span><span class="p">)</span>
+
+ <span class="c1"># raise_for_status</span>
+ <span class="n">request_args</span><span class="p">[</span><span class="s1">&#39;raise_for_httperror&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;raise_for_httperror&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span>
+
+ <span class="c1"># specific type of request (GET or POST)</span>
+ <span class="k">if</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;GET&#39;</span><span class="p">:</span>
+ <span class="n">req</span> <span class="o">=</span> <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">get</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">req</span> <span class="o">=</span> <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">post</span>
+
+ <span class="n">request_args</span><span class="p">[</span><span class="s1">&#39;data&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;data&#39;</span><span class="p">]</span>
+
+ <span class="c1"># send the request</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="n">req</span><span class="p">(</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;url&#39;</span><span class="p">],</span> <span class="o">**</span><span class="n">request_args</span><span class="p">)</span>
+
+ <span class="c1"># check soft limit of the redirect count</span>
+ <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">history</span><span class="p">)</span> <span class="o">&gt;</span> <span class="n">soft_max_redirects</span><span class="p">:</span>
+ <span class="c1"># unexpected redirect : record an error</span>
+ <span class="c1"># but the engine might still return valid results.</span>
+ <span class="n">status_code</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">status_code</span> <span class="ow">or</span> <span class="s1">&#39;&#39;</span><span class="p">)</span>
+ <span class="n">reason</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="n">reason_phrase</span> <span class="ow">or</span> <span class="s1">&#39;&#39;</span>
+ <span class="n">hostname</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="n">url</span><span class="o">.</span><span class="n">host</span>
+ <span class="n">count_error</span><span class="p">(</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">,</span>
+ <span class="s1">&#39;</span><span class="si">{}</span><span class="s1"> redirects, maximum: </span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">history</span><span class="p">),</span> <span class="n">soft_max_redirects</span><span class="p">),</span>
+ <span class="p">(</span><span class="n">status_code</span><span class="p">,</span> <span class="n">reason</span><span class="p">,</span> <span class="n">hostname</span><span class="p">),</span>
+ <span class="n">secondary</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
+ <span class="p">)</span>
+
+ <span class="k">return</span> <span class="n">response</span>
+
+ <span class="k">def</span> <span class="nf">_search_basic</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
+ <span class="c1"># update request parameters dependent on</span>
+ <span class="c1"># search-engine (contained in engines folder)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span>
+
+ <span class="c1"># ignoring empty urls</span>
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">params</span><span class="p">[</span><span class="s1">&#39;url&#39;</span><span class="p">]:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="c1"># send request</span>
+ <span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_send_http_request</span><span class="p">(</span><span class="n">params</span><span class="p">)</span>
+
+ <span class="c1"># parse the response</span>
+ <span class="n">response</span><span class="o">.</span><span class="n">search_params</span> <span class="o">=</span> <span class="n">params</span>
+ <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">response</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
+
+ <span class="k">def</span> <span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">,</span> <span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">timeout_limit</span><span class="p">):</span>
+ <span class="c1"># set timeout for all HTTP requests</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">set_timeout_for_thread</span><span class="p">(</span><span class="n">timeout_limit</span><span class="p">,</span> <span class="n">start_time</span><span class="o">=</span><span class="n">start_time</span><span class="p">)</span>
+ <span class="c1"># reset the HTTP total time</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">reset_time_for_thread</span><span class="p">()</span>
+ <span class="c1"># set the network</span>
+ <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">set_context_network_name</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">)</span>
+
+ <span class="k">try</span><span class="p">:</span>
+ <span class="c1"># send requests and parse the results</span>
+ <span class="n">search_results</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_search_basic</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">extend_container</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">search_results</span><span class="p">)</span>
+ <span class="k">except</span> <span class="n">ssl</span><span class="o">.</span><span class="n">SSLError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="c1"># requests timeout (connect or read)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;SSLError </span><span class="si">{}</span><span class="s2">, verify=</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">searx</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">get_network</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_name</span><span class="p">)</span><span class="o">.</span><span class="n">verify</span><span class="p">))</span>
+ <span class="k">except</span> <span class="p">(</span><span class="n">httpx</span><span class="o">.</span><span class="n">TimeoutException</span><span class="p">,</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">TimeoutError</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="c1"># requests timeout (connect or read)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span>
+ <span class="s2">&quot;HTTP requests timeout (search duration : </span><span class="si">{0}</span><span class="s2"> s, timeout: </span><span class="si">{1}</span><span class="s2"> s) : </span><span class="si">{2}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
+ <span class="n">default_timer</span><span class="p">()</span> <span class="o">-</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">timeout_limit</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span>
+ <span class="p">)</span>
+ <span class="p">)</span>
+ <span class="k">except</span> <span class="p">(</span><span class="n">httpx</span><span class="o">.</span><span class="n">HTTPError</span><span class="p">,</span> <span class="n">httpx</span><span class="o">.</span><span class="n">StreamError</span><span class="p">)</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="c1"># other requests exception</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span>
+ <span class="s2">&quot;requests exception (search duration : </span><span class="si">{0}</span><span class="s2"> s, timeout: </span><span class="si">{1}</span><span class="s2"> s) : </span><span class="si">{2}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
+ <span class="n">default_timer</span><span class="p">()</span> <span class="o">-</span> <span class="n">start_time</span><span class="p">,</span> <span class="n">timeout_limit</span><span class="p">,</span> <span class="n">e</span>
+ <span class="p">)</span>
+ <span class="p">)</span>
+ <span class="k">except</span> <span class="n">SearxEngineCaptchaException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;CAPTCHA&#39;</span><span class="p">)</span>
+ <span class="k">except</span> <span class="n">SearxEngineTooManyRequestsException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;Too many requests&#39;</span><span class="p">)</span>
+ <span class="k">except</span> <span class="n">SearxEngineAccessDeniedException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="n">suspend</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;SearXNG is blocked&#39;</span><span class="p">)</span>
+ <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">handle_exception</span><span class="p">(</span><span class="n">result_container</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
+ <span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">exception</span><span class="p">(</span><span class="s1">&#39;exception : </span><span class="si">{0}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
+
+ <span class="k">def</span> <span class="nf">get_default_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">tests</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;simple&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="p">(</span><span class="s1">&#39;life&#39;</span><span class="p">,</span> <span class="s1">&#39;computer&#39;</span><span class="p">)},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">],</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;paging&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;paging&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;time&#39;</span><span class="p">,</span> <span class="s1">&#39;pageno&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">],</span>
+ <span class="s1">&#39;test&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;unique_results&#39;</span><span class="p">],</span>
+ <span class="p">}</span>
+ <span class="k">if</span> <span class="s1">&#39;general&#39;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="o">.</span><span class="n">categories</span><span class="p">:</span>
+ <span class="c1"># avoid documentation about HTML tags (&lt;time&gt; and &lt;input type=&quot;time&quot;&gt;)</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;paging&#39;</span><span class="p">][</span><span class="s1">&#39;matrix&#39;</span><span class="p">][</span><span class="s1">&#39;query&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;news&#39;</span>
+
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;time_range&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;time_range&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;news&#39;</span><span class="p">,</span> <span class="s1">&#39;time_range&#39;</span><span class="p">:</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="s1">&#39;day&#39;</span><span class="p">)},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">],</span>
+ <span class="s1">&#39;test&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;unique_results&#39;</span><span class="p">],</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;traits&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;lang_fr&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;paris&#39;</span><span class="p">,</span> <span class="s1">&#39;lang&#39;</span><span class="p">:</span> <span class="s1">&#39;fr&#39;</span><span class="p">},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">,</span> <span class="p">(</span><span class="s1">&#39;has_language&#39;</span><span class="p">,</span> <span class="s1">&#39;fr&#39;</span><span class="p">)],</span>
+ <span class="p">}</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;lang_en&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;paris&#39;</span><span class="p">,</span> <span class="s1">&#39;lang&#39;</span><span class="p">:</span> <span class="s1">&#39;en&#39;</span><span class="p">},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">,</span> <span class="p">(</span><span class="s1">&#39;has_language&#39;</span><span class="p">,</span> <span class="s1">&#39;en&#39;</span><span class="p">)],</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;safesearch&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;safesearch&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;porn&#39;</span><span class="p">,</span> <span class="s1">&#39;safesearch&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)},</span> <span class="s1">&#39;test&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;unique_results&#39;</span><span class="p">]}</span>
+
+ <span class="k">return</span> <span class="n">tests</span></div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/_modules/searx/search/processors/online_currency.html b/_modules/searx/search/processors/online_currency.html
new file mode 100644
index 000000000..9cc8a1442
--- /dev/null
+++ b/_modules/searx/search/processors/online_currency.html
@@ -0,0 +1,187 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.online_currency &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.online_currency</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.online_currency</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Processors for engine-type: ``online_currency``</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">unicodedata</span>
+<span class="kn">import</span> <span class="nn">re</span>
+
+<span class="kn">from</span> <span class="nn">searx.data</span> <span class="kn">import</span> <span class="n">CURRENCIES</span>
+<span class="kn">from</span> <span class="nn">.online</span> <span class="kn">import</span> <span class="n">OnlineProcessor</span>
+
+<span class="n">parser_re</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">&#39;.*?(</span><span class="se">\\</span><span class="s1">d+(?:</span><span class="se">\\</span><span class="s1">.</span><span class="se">\\</span><span class="s1">d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)&#39;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">I</span><span class="p">)</span>
+
+
+<span class="k">def</span> <span class="nf">normalize_name</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+ <span class="n">name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s1">&#39; &#39;</span><span class="p">)</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="s1">&#39;s&#39;</span><span class="p">)</span>
+ <span class="n">name</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s1">&#39; +&#39;</span><span class="p">,</span> <span class="s1">&#39; &#39;</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">unicodedata</span><span class="o">.</span><span class="n">normalize</span><span class="p">(</span><span class="s1">&#39;NFKD&#39;</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
+
+
+<span class="k">def</span> <span class="nf">name_to_iso4217</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+ <span class="n">name</span> <span class="o">=</span> <span class="n">normalize_name</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+ <span class="n">currency</span> <span class="o">=</span> <span class="n">CURRENCIES</span><span class="p">[</span><span class="s1">&#39;names&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">[</span><span class="n">name</span><span class="p">])</span>
+ <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">currency</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">currency</span>
+ <span class="k">return</span> <span class="n">currency</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+
+
+<span class="k">def</span> <span class="nf">iso4217_to_name</span><span class="p">(</span><span class="n">iso4217</span><span class="p">,</span> <span class="n">language</span><span class="p">):</span>
+ <span class="k">return</span> <span class="n">CURRENCIES</span><span class="p">[</span><span class="s1">&#39;iso4217&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">iso4217</span><span class="p">,</span> <span class="p">{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">language</span><span class="p">,</span> <span class="n">iso4217</span><span class="p">)</span>
+
+
+<div class="viewcode-block" id="OnlineCurrencyProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_currency.OnlineCurrencyProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">OnlineCurrencyProcessor</span><span class="p">(</span><span class="n">OnlineProcessor</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Processor class used by ``online_currency`` engines.&quot;&quot;&quot;</span>
+
+ <span class="n">engine_type</span> <span class="o">=</span> <span class="s1">&#39;online_currency&#39;</span>
+
+<div class="viewcode-block" id="OnlineCurrencyProcessor.get_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_currency.OnlineCurrencyProcessor.get_params">[docs]</a>
+ <span class="k">def</span> <span class="nf">get_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a set of :ref:`request params &lt;engine request online_currency&gt;`</span>
+<span class="sd"> or ``None`` if search query does not match to :py:obj:`parser_re`.&quot;&quot;&quot;</span>
+
+ <span class="n">params</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_params</span><span class="p">(</span><span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">params</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">m</span> <span class="o">=</span> <span class="n">parser_re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">search_query</span><span class="o">.</span><span class="n">query</span><span class="p">)</span>
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">m</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">amount_str</span><span class="p">,</span> <span class="n">from_currency</span><span class="p">,</span> <span class="n">to_currency</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">groups</span><span class="p">()</span>
+ <span class="k">try</span><span class="p">:</span>
+ <span class="n">amount</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">amount_str</span><span class="p">)</span>
+ <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+ <span class="n">from_currency</span> <span class="o">=</span> <span class="n">name_to_iso4217</span><span class="p">(</span><span class="n">from_currency</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+ <span class="n">to_currency</span> <span class="o">=</span> <span class="n">name_to_iso4217</span><span class="p">(</span><span class="n">to_currency</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;amount&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">amount</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;from&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">from_currency</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;to&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">to_currency</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;from_name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">iso4217_to_name</span><span class="p">(</span><span class="n">from_currency</span><span class="p">,</span> <span class="s1">&#39;en&#39;</span><span class="p">)</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;to_name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">iso4217_to_name</span><span class="p">(</span><span class="n">to_currency</span><span class="p">,</span> <span class="s1">&#39;en&#39;</span><span class="p">)</span>
+ <span class="k">return</span> <span class="n">params</span></div>
+
+
+ <span class="k">def</span> <span class="nf">get_default_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">tests</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;currency&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;1337 usd in rmb&#39;</span><span class="p">},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;has_answer&#39;</span><span class="p">],</span>
+ <span class="p">}</span>
+
+ <span class="k">return</span> <span class="n">tests</span></div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/_modules/searx/search/processors/online_dictionary.html b/_modules/searx/search/processors/online_dictionary.html
new file mode 100644
index 000000000..a479b8f25
--- /dev/null
+++ b/_modules/searx/search/processors/online_dictionary.html
@@ -0,0 +1,174 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.online_dictionary &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.online_dictionary</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.online_dictionary</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Processors for engine-type: ``online_dictionary``</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">re</span>
+
+<span class="kn">from</span> <span class="nn">searx.utils</span> <span class="kn">import</span> <span class="n">is_valid_lang</span>
+<span class="kn">from</span> <span class="nn">.online</span> <span class="kn">import</span> <span class="n">OnlineProcessor</span>
+
+<span class="n">parser_re</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">&#39;.*?([a-z]+)-([a-z]+) (.+)$&#39;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">I</span><span class="p">)</span>
+
+
+<div class="viewcode-block" id="OnlineDictionaryProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_dictionary.OnlineDictionaryProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">OnlineDictionaryProcessor</span><span class="p">(</span><span class="n">OnlineProcessor</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Processor class used by ``online_dictionary`` engines.&quot;&quot;&quot;</span>
+
+ <span class="n">engine_type</span> <span class="o">=</span> <span class="s1">&#39;online_dictionary&#39;</span>
+
+<div class="viewcode-block" id="OnlineDictionaryProcessor.get_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_params">[docs]</a>
+ <span class="k">def</span> <span class="nf">get_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a set of :ref:`request params &lt;engine request online_dictionary&gt;` or</span>
+<span class="sd"> ``None`` if search query does not match to :py:obj:`parser_re`.</span>
+<span class="sd"> &quot;&quot;&quot;</span>
+ <span class="n">params</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_params</span><span class="p">(</span><span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">params</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">m</span> <span class="o">=</span> <span class="n">parser_re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">search_query</span><span class="o">.</span><span class="n">query</span><span class="p">)</span>
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">m</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">from_lang</span><span class="p">,</span> <span class="n">to_lang</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">groups</span><span class="p">()</span>
+
+ <span class="n">from_lang</span> <span class="o">=</span> <span class="n">is_valid_lang</span><span class="p">(</span><span class="n">from_lang</span><span class="p">)</span>
+ <span class="n">to_lang</span> <span class="o">=</span> <span class="n">is_valid_lang</span><span class="p">(</span><span class="n">to_lang</span><span class="p">)</span>
+
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">from_lang</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">to_lang</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;from_lang&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">from_lang</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;to_lang&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">to_lang</span>
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;query&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">query</span>
+
+ <span class="k">return</span> <span class="n">params</span></div>
+
+
+ <span class="k">def</span> <span class="nf">get_default_tests</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+ <span class="n">tests</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">engine</span><span class="p">,</span> <span class="s1">&#39;paging&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;translation_paging&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;en-es house&#39;</span><span class="p">,</span> <span class="s1">&#39;pageno&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">,</span> <span class="p">(</span><span class="s1">&#39;one_title_contains&#39;</span><span class="p">,</span> <span class="s1">&#39;house&#39;</span><span class="p">)],</span>
+ <span class="s1">&#39;test&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;unique_results&#39;</span><span class="p">],</span>
+ <span class="p">}</span>
+ <span class="k">else</span><span class="p">:</span>
+ <span class="n">tests</span><span class="p">[</span><span class="s1">&#39;translation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;matrix&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s1">&#39;query&#39;</span><span class="p">:</span> <span class="s1">&#39;en-es house&#39;</span><span class="p">},</span>
+ <span class="s1">&#39;result_container&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;not_empty&#39;</span><span class="p">,</span> <span class="p">(</span><span class="s1">&#39;one_title_contains&#39;</span><span class="p">,</span> <span class="s1">&#39;house&#39;</span><span class="p">)],</span>
+ <span class="p">}</span>
+
+ <span class="k">return</span> <span class="n">tests</span></div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/_modules/searx/search/processors/online_url_search.html b/_modules/searx/search/processors/online_url_search.html
new file mode 100644
index 000000000..c0c87d4b5
--- /dev/null
+++ b/_modules/searx/search/processors/online_url_search.html
@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+
+<html lang="en" data-content_root="../../../../">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>searx.search.processors.online_url_search &#8212; SearXNG Documentation (2025.1.6+6dab7fe78)</title>
+ <link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=4f649999" />
+ <link rel="stylesheet" type="text/css" href="../../../../_static/searxng.css?v=52e4ff28" />
+ <script src="../../../../_static/documentation_options.js?v=ef740023"></script>
+ <script src="../../../../_static/doctools.js?v=9a2dae69"></script>
+ <script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
+ <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../../_static/describe_version.js?v=fa7f30d0"></script>
+ <link rel="index" title="Index" href="../../../../genindex.html" />
+ <link rel="search" title="Search" href="../../../../search.html" />
+ </head><body>
+ <div class="related" role="navigation" aria-label="Related">
+ <h3>Navigation</h3>
+ <ul>
+ <li class="right" style="margin-right: 10px">
+ <a href="../../../../genindex.html" title="General Index"
+ accesskey="I">index</a></li>
+ <li class="right" >
+ <a href="../../../../py-modindex.html" title="Python Module Index"
+ >modules</a> |</li>
+ <li class="nav-item nav-item-0"><a href="../../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> &#187;</li>
+ <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
+ <li class="nav-item nav-item-2"><a href="../../search.html" accesskey="U">searx.search</a> &#187;</li>
+ <li class="nav-item nav-item-this"><a href="">searx.search.processors.online_url_search</a></li>
+ </ul>
+ </div>
+
+ <div class="document">
+ <div class="documentwrapper">
+ <div class="bodywrapper">
+ <div class="body" role="main">
+
+ <h1>Source code for searx.search.processors.online_url_search</h1><div class="highlight"><pre>
+<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
+<span class="sd">&quot;&quot;&quot;Processors for engine-type: ``online_url_search``</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">re</span>
+<span class="kn">from</span> <span class="nn">.online</span> <span class="kn">import</span> <span class="n">OnlineProcessor</span>
+
+<span class="n">re_search_urls</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="s1">&#39;http&#39;</span><span class="p">:</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;https?:\/\/[^ ]*&#39;</span><span class="p">),</span>
+ <span class="s1">&#39;ftp&#39;</span><span class="p">:</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;ftps?:\/\/[^ ]*&#39;</span><span class="p">),</span>
+ <span class="s1">&#39;data:image&#39;</span><span class="p">:</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s1">&#39;data:image/[^; ]*;base64,[^ ]*&#39;</span><span class="p">),</span>
+<span class="p">}</span>
+
+
+<div class="viewcode-block" id="OnlineUrlSearchProcessor">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_url_search.OnlineUrlSearchProcessor">[docs]</a>
+<span class="k">class</span> <span class="nc">OnlineUrlSearchProcessor</span><span class="p">(</span><span class="n">OnlineProcessor</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Processor class used by ``online_url_search`` engines.&quot;&quot;&quot;</span>
+
+ <span class="n">engine_type</span> <span class="o">=</span> <span class="s1">&#39;online_url_search&#39;</span>
+
+<div class="viewcode-block" id="OnlineUrlSearchProcessor.get_params">
+<a class="viewcode-back" href="../../../../src/searx.search.processors.html#searx.search.processors.online_url_search.OnlineUrlSearchProcessor.get_params">[docs]</a>
+ <span class="k">def</span> <span class="nf">get_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">):</span>
+<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a set of :ref:`request params &lt;engine request online&gt;` or ``None`` if</span>
+<span class="sd"> search query does not match to :py:obj:`re_search_urls`.</span>
+<span class="sd"> &quot;&quot;&quot;</span>
+
+ <span class="n">params</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_params</span><span class="p">(</span><span class="n">search_query</span><span class="p">,</span> <span class="n">engine_category</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">params</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">url_match</span> <span class="o">=</span> <span class="kc">False</span>
+ <span class="n">search_urls</span> <span class="o">=</span> <span class="p">{}</span>
+
+ <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">re_search_urls</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
+ <span class="n">m</span> <span class="o">=</span> <span class="n">v</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">search_query</span><span class="o">.</span><span class="n">query</span><span class="p">)</span>
+ <span class="n">v</span> <span class="o">=</span> <span class="kc">None</span>
+ <span class="k">if</span> <span class="n">m</span><span class="p">:</span>
+ <span class="n">url_match</span> <span class="o">=</span> <span class="kc">True</span>
+ <span class="n">v</span> <span class="o">=</span> <span class="n">m</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+ <span class="n">search_urls</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+
+ <span class="k">if</span> <span class="ow">not</span> <span class="n">url_match</span><span class="p">:</span>
+ <span class="k">return</span> <span class="kc">None</span>
+
+ <span class="n">params</span><span class="p">[</span><span class="s1">&#39;search_urls&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">search_urls</span>
+ <span class="k">return</span> <span class="n">params</span></div>
+</div>
+
+</pre></div>
+
+ <div class="clearer"></div>
+ </div>
+ </div>
+ </div>
+ <span id="sidebar-top"></span>
+ <div class="sphinxsidebar" role="navigation" aria-label="Main">
+ <div class="sphinxsidebarwrapper">
+
+
+ <p class="logo"><a href="../../../../index.html">
+ <img class="logo" src="../../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
+ </a></p>
+
+
+<h3><a href="../../../../index.html">Table of Contents</a></h3>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../../../../user/index.html">User information</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../own-instance.html">Why use a private instance?</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../admin/index.html">Administrator documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../dev/index.html">Developer documentation</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../utils/index.html">DevOps tooling box</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../../../../src/index.html">Source-Code</a></li>
+</ul>
+
+ <h3>Project Links</h3>
+ <ul>
+ <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
+
+ <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
+
+ <li><a href="https://searx.space">Public instances</a>
+
+ <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
+ </ul><h3>Navigation</h3>
+<ul>
+ <li><a href="../../../../index.html">Overview</a>
+ <ul>
+ <li><a href="../../../index.html">Module code</a>
+ <ul>
+ <li><a href="../../search.html">searx.search</a>
+
+
+ </ul>
+ </li></ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<search id="searchbox" style="display: none" role="search">
+ <h3 id="searchlabel">Quick search</h3>
+ <div class="searchformwrapper">
+ <form class="search" action="../../../../search.html" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
+ <input type="submit" value="Go" />
+ </form>
+ </div>
+</search>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+ </div>
+ </div>
+ <div class="clearer"></div>
+ </div>
+ <div class="footer" role="contentinfo">
+ &#169; Copyright SearXNG team.
+ </div>
+ </body>
+</html> \ No newline at end of file