2021-06-04 16:23:30 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2021-06-06 06:13:50 +00:00
|
|
|
# lint: pylint
|
|
|
|
"""This module holds the *data* created by::
|
2021-06-04 16:23:30 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
make data.all
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
"""
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2021-06-04 16:23:30 +00:00
|
|
|
__all__ = [
|
|
|
|
'ENGINES_LANGUAGES',
|
|
|
|
'CURRENCIES',
|
|
|
|
'USER_AGENTS',
|
|
|
|
'EXTERNAL_URLS',
|
|
|
|
'WIKIDATA_UNITS',
|
|
|
|
'EXTERNAL_BANGS',
|
|
|
|
'OSM_KEYS_TAGS',
|
2021-09-18 08:59:56 +00:00
|
|
|
'ENGINE_DESCRIPTIONS',
|
2021-06-04 16:23:30 +00:00
|
|
|
'ahmia_blacklist_loader',
|
|
|
|
]
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
import json
|
|
|
|
from pathlib import Path
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
data_dir = Path(__file__).parent
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
def _load(filename):
|
|
|
|
with open(data_dir / filename, encoding='utf-8') as f:
|
|
|
|
return json.load(f)
|
2020-10-05 11:50:33 +00:00
|
|
|
|
2020-10-26 19:40:24 +00:00
|
|
|
def ahmia_blacklist_loader():
|
2021-06-06 06:13:50 +00:00
|
|
|
"""Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
|
|
|
|
names. The MD5 values are fetched by::
|
|
|
|
|
|
|
|
searx_extra/update/update_ahmia_blacklist.py
|
|
|
|
|
|
|
|
This function is used by :py:mod:`searx.plugins.ahmia_filter`.
|
2020-10-26 19:40:24 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
"""
|
|
|
|
with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
|
|
|
|
return f.read().split()
|
2020-10-26 19:40:24 +00:00
|
|
|
|
2021-06-06 06:13:50 +00:00
|
|
|
ENGINES_LANGUAGES = _load('engines_languages.json')
|
|
|
|
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 08:59:56 +00:00
|
|
|
ENGINE_DESCRIPTIONS = _load('engine_descriptions.json')
|