mirror of
https://github.com/searxng/searxng.git
synced 2024-11-23 12:31:25 +01:00
542f7d0d7b
In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
33 lines
949 B
Python
Executable File
33 lines
949 B
Python
Executable File
#!/usr/bin/env python
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""This script saves `Ahmia's blacklist`_ for onion sites.
|
|
|
|
Output file: :origin:`searx/data/ahmia_blacklist.txt` (:origin:`CI Update data
|
|
... <.github/workflows/data-update.yml>`).
|
|
|
|
.. _Ahmia's blacklist: https://ahmia.fi/blacklist/
|
|
|
|
"""
|
|
# pylint: disable=use-dict-literal
|
|
|
|
import requests
|
|
from searx.data import data_dir
|
|
|
|
DATA_FILE = data_dir / 'ahmia_blacklist.txt'
|
|
URL = 'https://ahmia.fi/blacklist/banned/'
|
|
|
|
|
|
def fetch_ahmia_blacklist():
|
|
resp = requests.get(URL, timeout=3.0)
|
|
if resp.status_code != 200:
|
|
# pylint: disable=broad-exception-raised
|
|
raise Exception("Error fetching Ahmia blacklist, HTTP code " + resp.status_code) # type: ignore
|
|
return resp.text.split()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
blacklist = fetch_ahmia_blacklist()
|
|
blacklist.sort()
|
|
with DATA_FILE.open("w", encoding='utf-8') as f:
|
|
f.write('\n'.join(blacklist))
|