2021-06-04 18:23:30 +02:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2021-06-06 08:13:50 +02:00
|
|
|
# lint: pylint
|
|
|
|
"""This module holds the *data* created by::
|
2021-06-04 18:23:30 +02:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
make data.all
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
"""
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-06-04 18:23:30 +02:00
|
|
|
__all__ = [
|
2022-09-29 20:54:46 +02:00
|
|
|
'ENGINE_TRAITS',
|
2021-06-04 18:23:30 +02:00
|
|
|
'CURRENCIES',
|
|
|
|
'USER_AGENTS',
|
|
|
|
'EXTERNAL_URLS',
|
|
|
|
'WIKIDATA_UNITS',
|
|
|
|
'EXTERNAL_BANGS',
|
|
|
|
'OSM_KEYS_TAGS',
|
2021-09-18 10:59:56 +02:00
|
|
|
'ENGINE_DESCRIPTIONS',
|
2024-02-16 21:46:18 +01:00
|
|
|
'LOCALES',
|
2021-06-04 18:23:30 +02:00
|
|
|
'ahmia_blacklist_loader',
|
|
|
|
]
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
import json
|
|
|
|
from pathlib import Path
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
data_dir = Path(__file__).parent
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-12-27 09:26:22 +01:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
def _load(filename):
|
|
|
|
with open(data_dir / filename, encoding='utf-8') as f:
|
|
|
|
return json.load(f)
|
2020-10-05 13:50:33 +02:00
|
|
|
|
2021-12-27 09:26:22 +01:00
|
|
|
|
2020-10-26 20:40:24 +01:00
|
|
|
def ahmia_blacklist_loader():
|
2021-06-06 08:13:50 +02:00
|
|
|
"""Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
|
|
|
|
names. The MD5 values are fetched by::
|
|
|
|
|
2021-10-02 17:30:39 +02:00
|
|
|
searxng_extra/update/update_ahmia_blacklist.py
|
2021-06-06 08:13:50 +02:00
|
|
|
|
|
|
|
This function is used by :py:mod:`searx.plugins.ahmia_filter`.
|
2020-10-26 20:40:24 +01:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
"""
|
2022-01-29 08:54:12 +01:00
|
|
|
with open(data_dir / 'ahmia_blacklist.txt', encoding='utf-8') as f:
|
2021-06-06 08:13:50 +02:00
|
|
|
return f.read().split()
|
2020-10-26 20:40:24 +01:00
|
|
|
|
2021-12-27 09:26:22 +01:00
|
|
|
|
2021-06-06 08:13:50 +02:00
|
|
|
CURRENCIES = _load('currencies.json')
|
|
|
|
USER_AGENTS = _load('useragents.json')
|
|
|
|
EXTERNAL_URLS = _load('external_urls.json')
|
|
|
|
WIKIDATA_UNITS = _load('wikidata_units.json')
|
|
|
|
EXTERNAL_BANGS = _load('external_bangs.json')
|
|
|
|
OSM_KEYS_TAGS = _load('osm_keys_tags.json')
|
2021-09-18 10:59:56 +02:00
|
|
|
ENGINE_DESCRIPTIONS = _load('engine_descriptions.json')
|
2022-09-29 20:54:46 +02:00
|
|
|
ENGINE_TRAITS = _load('engine_traits.json')
|
2024-02-16 21:46:18 +01:00
|
|
|
LOCALES = _load('locales.json')
|