SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
A bit of cleanup of the code - regexes in a array - regexes applied only on the last part of the url
Cqoicebordele93f5314d745
diff --git a/searx/plugins/tracker_url_remover.py b/searx/plugins/tracker_url_remover.pyindex c8459548f..f6ecc2126 100644--- a/searx/plugins/tracker_url_remover.py+++ b/searx/plugins/tracker_url_remover.py@@ -18,10 +18,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.from flask.ext.babel import gettextimport re-re1 = re.compile(r'utm_[^&]+&?')-re2 = re.compile(r'(wkey|wemail)[^&]+&?')-re3 = re.compile(r'&$')-re4 = re.compile(r'^\?$')+regexes = {re.compile(r'utm_[^&]+&?'),+ re.compile(r'(wkey|wemail)[^&]+&?'),+ re.compile(r'&$')}name = gettext('Tracker URL remover')description = gettext('Remove trackers arguments from the returned URL')@@ -29,12 +28,17 @@ default_on = Truedef on_result(request, ctx):- url = ctx['result']['url']+ splited_url = ctx['result']['url'].split('?')- url = re1.sub('', url)- url = re2.sub('', url)- url = re3.sub('', url)- url = re4.sub('', url)+ if len(splited_url) is not 2:+ return True++ for reg in regexes:+ splited_url[1] = reg.sub('', splited_url[1])++ if splited_url[1] == "":+ ctx['result']['url'] = splited_url[0]+ else:+ ctx['result']['url'] = splited_url[0] + '?' + splited_url[1]- ctx['result']['url'] = urlreturn True