.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.plugins.tracker_url_remover Namespace Reference

Functions

 on_result (_request, _search, result)
 

Variables

dict regexes
 
 name = gettext('Tracker URL remover')
 
 description = gettext('Remove trackers arguments from the returned URL')
 
bool default_on = True
 
str preference_section = 'privacy'
 

Function Documentation

◆ on_result()

searx.plugins.tracker_url_remover.on_result ( _request,
_search,
result )

Definition at line 22 of file tracker_url_remover.py.

22def on_result(_request, _search, result):
23 if 'parsed_url' not in result:
24 return True
25
26 query = result['parsed_url'].query
27
28 if query == "":
29 return True
30 parsed_query = parse_qsl(query)
31
32 changes = 0
33 for i, (param_name, _) in enumerate(list(parsed_query)):
34 for reg in regexes:
35 if reg.match(param_name):
36 parsed_query.pop(i - changes)
37 changes += 1
38 result['parsed_url'] = result['parsed_url']._replace(query=urlencode(parsed_query))
39 result['url'] = urlunparse(result['parsed_url'])
40 break
41
42 return True

Variable Documentation

◆ default_on

bool searx.plugins.tracker_url_remover.default_on = True

Definition at line 18 of file tracker_url_remover.py.

◆ description

searx.plugins.tracker_url_remover.description = gettext('Remove trackers arguments from the returned URL')

Definition at line 17 of file tracker_url_remover.py.

◆ name

searx.plugins.tracker_url_remover.name = gettext('Tracker URL remover')

Definition at line 16 of file tracker_url_remover.py.

◆ preference_section

str searx.plugins.tracker_url_remover.preference_section = 'privacy'

Definition at line 19 of file tracker_url_remover.py.

◆ regexes

dict searx.plugins.tracker_url_remover.regexes
Initial value:
1= {
2 re.compile(r'utm_[^&]+'),
3 re.compile(r'(wkey|wemail)[^&]*'),
4 re.compile(r'(_hsenc|_hsmi|hsCtaTracking|__hssc|__hstc|__hsfp)[^&]*'),
5 re.compile(r'&$'),
6}

Definition at line 9 of file tracker_url_remover.py.