diff options
author | dalf <alex@al-f.net> | 2016-10-22 14:01:53 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2016-11-02 14:22:16 +0100 |
commit | fbb080f3588ad43bf896a569257f3a95e1181d7b (patch) | |
tree | 8852a7af03c4e9bafe65885fae89417d47da7685 /searx/plugins/tracker_url_remover.py | |
parent | 67e11c42b973932c8f568d80a0f25bfd7fc150ab (diff) | |
download | searxng-fbb080f3588ad43bf896a569257f3a95e1181d7b.tar.gz searxng-fbb080f3588ad43bf896a569257f3a95e1181d7b.zip |
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
Diffstat (limited to 'searx/plugins/tracker_url_remover.py')
-rw-r--r-- | searx/plugins/tracker_url_remover.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 |