.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.plugins.tracker_url_remover.SXNGPlugin Class Reference
+ Inheritance diagram for searx.plugins.tracker_url_remover.SXNGPlugin:
+ Collaboration diagram for searx.plugins.tracker_url_remover.SXNGPlugin:

Public Member Functions

None __init__ (self, "PluginCfg" plg_cfg)
 
bool on_result (self, "SXNG_Request" request, "SearchWithPlugins" search, Result result)
 
- Public Member Functions inherited from searx.plugins._core.Plugin
None __init__ (self, PluginCfg plg_cfg)
 
int __hash__ (self)
 
 __eq__ (self, other)
 
bool init (self, "flask.Flask" app)
 
bool pre_search (self, SXNG_Request request, "SearchWithPlugins" search)
 
None|typing.Sequence[Resultpost_search (self, SXNG_Request request, "SearchWithPlugins" search)
 

Public Attributes

 info
 

Additional Inherited Members

- Static Public Attributes inherited from searx.plugins._core.Plugin
str id = ""
 
typing active .ClassVar[bool]
 
list keywords = []
 
logging log .Logger
 
str fqn = ""
 

Detailed Description

Remove trackers arguments from the returned URL

Definition at line 28 of file tracker_url_remover.py.

Constructor & Destructor Documentation

◆ __init__()

None searx.plugins.tracker_url_remover.SXNGPlugin.__init__ ( self,
"PluginCfg" plg_cfg )

Definition at line 33 of file tracker_url_remover.py.

33 def __init__(self, plg_cfg: "PluginCfg") -> None:
34 super().__init__(plg_cfg)
35 self.info = PluginInfo(
36 id=self.id,
37 name=gettext("Tracker URL remover"),
38 description=gettext("Remove trackers arguments from the returned URL"),
39 preference_section="privacy",
40 )
41

References __init__().

Referenced by __init__().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ on_result()

bool searx.plugins.tracker_url_remover.SXNGPlugin.on_result ( self,
"SXNG_Request" request,
"SearchWithPlugins" search,
Result result )
Runs for each result of each engine and returns a boolean:

- ``True`` to keep the result
- ``False`` to remove the result from the result list

The ``result`` can be modified to the needs.

.. hint::

   If :py:obj:`Result.url <searx.result_types._base.Result.url>` is modified,
   :py:obj:`Result.parsed_url <searx.result_types._base.Result.parsed_url>` must
   be changed accordingly:

   .. code:: python

      result["parsed_url"] = urlparse(result["url"])

Reimplemented from searx.plugins._core.Plugin.

Definition at line 42 of file tracker_url_remover.py.

44 ) -> bool: # pylint: disable=unused-argument
45 if not result.parsed_url:
46 return True
47
48 parsed_query: list[tuple[str, str]] = parse_qsl(result.parsed_url.query)
49 for name_value in list(parsed_query):
50 param_name = name_value[0]
51 for reg in regexes:
52 if reg.match(param_name):
53 parsed_query.remove(name_value)
54 result.parsed_url = result.parsed_url._replace(query=urlencode(parsed_query))
55 result.url = urlunparse(result.parsed_url)
56 break
57
58 return True

Member Data Documentation

◆ info

searx.plugins.tracker_url_remover.SXNGPlugin.info
Initial value:
= PluginInfo(
id=self.id,
name=gettext("Tracker URL remover"),
description=gettext("Remove trackers arguments from the returned URL"),
preference_section="privacy",
)

Definition at line 35 of file tracker_url_remover.py.


The documentation for this class was generated from the following file: