mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[mod] ahmia_filter: use on_result instead of post_search
see commit 6c9ae7911e9639bc46cd53af215734b4bdb61ba9
This commit is contained in:
parent
660c180170
commit
b941763e20
@ -20,14 +20,8 @@ def get_ahmia_blacklist():
|
||||
return ahmia_blacklist
|
||||
|
||||
|
||||
def not_blacklisted(result):
|
||||
def on_result(request, search, result):
|
||||
if not result.get('is_onion') or not result.get('parsed_url'):
|
||||
return True
|
||||
result_hash = md5(result['parsed_url'].hostname.encode()).hexdigest()
|
||||
return result_hash not in get_ahmia_blacklist()
|
||||
|
||||
|
||||
def post_search(request, search):
|
||||
filtered_results = list(filter(not_blacklisted, search.result_container._merged_results))
|
||||
search.result_container._merged_results = filtered_results
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user