.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
ahmia_filter.py
Go to the documentation of this file.
1
# SPDX-License-Identifier: AGPL-3.0-or-later
2
# pylint: disable=missing-module-docstring
3
4
from
hashlib
import
md5
5
from
searx.data
import
ahmia_blacklist_loader
6
7
name =
"Ahmia blacklist"
8
description =
"Filter out onion results that appear in Ahmia's blacklist. (See https://ahmia.fi/blacklist)"
9
default_on =
True
10
preference_section =
'onions'
11
12
ahmia_blacklist =
None
13
14
15
def
on_result
(_request, _search, result):
16
if
not
result.get(
'is_onion'
)
or
not
result.get(
'parsed_url'
):
17
return
True
18
result_hash = md5(result[
'parsed_url'
].hostname.encode()).hexdigest()
19
return
result_hash
not
in
ahmia_blacklist
20
21
22
def
init
(_app, settings):
23
global
ahmia_blacklist
# pylint: disable=global-statement
24
if
not
settings[
'outgoing'
][
'using_tor_proxy'
]:
25
# disable the plugin
26
return
False
27
ahmia_blacklist = ahmia_blacklist_loader()
28
return
True
searx.data
Definition
__init__.py:1
searx.plugins.ahmia_filter.init
init(_app, settings)
Definition
ahmia_filter.py:22
searx.plugins.ahmia_filter.on_result
on_result(_request, _search, result)
Definition
ahmia_filter.py:15
searxng
searx
plugins
ahmia_filter.py
Generated on Sat Nov 16 2024 00:10:57 for .oO SearXNG Developer Documentation Oo. by
1.12.0