From fbb080f3588ad43bf896a569257f3a95e1181d7b Mon Sep 17 00:00:00 2001 From: dalf Date: Sat, 22 Oct 2016 14:01:53 +0200 Subject: Change plugin API : - pre_search(request, search) - post_search(request, search) - on_result(request, search, result) with - request is the Flask request - search a searx.Search instance - result a searx result as usual --- searx/plugins/tracker_url_remover.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'searx/plugins/tracker_url_remover.py') diff --git a/searx/plugins/tracker_url_remover.py b/searx/plugins/tracker_url_remover.py index b909e3fae..68a004e33 100644 --- a/searx/plugins/tracker_url_remover.py +++ b/searx/plugins/tracker_url_remover.py @@ -28,8 +28,8 @@ description = gettext('Remove trackers arguments from the returned URL') default_on = True -def on_result(request, ctx): - query = ctx['result']['parsed_url'].query +def on_result(request, search, result): + query = result['parsed_url'].query if query == "": return True @@ -37,8 +37,8 @@ def on_result(request, ctx): for reg in regexes: query = reg.sub('', query) - if query != ctx['result']['parsed_url'].query: - ctx['result']['parsed_url'] = ctx['result']['parsed_url']._replace(query=query) - ctx['result']['url'] = urlunparse(ctx['result']['parsed_url']) + if query != result['parsed_url'].query: + result['parsed_url'] = result['parsed_url']._replace(query=query) + result['url'] = urlunparse(result['parsed_url']) return True -- cgit v1.2.3-54-g00ecf