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__ = [
|
|
|
|
'ENGINES_LANGUAGES',
|
|
|
|
'CURRENCIES',
|
|
|
|
'USER_AGENTS',
|
|
|
|
'EXTERNAL_URLS',
|
|
|
|
'WIKIDATA_UNITS',
|
|
|
|
'EXTERNAL_BANGS',
|
|
|
|
'OSM_KEYS_TAGS',
|
|
|
|
'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-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
|
|
|
|
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::
|
|
|
|
|
|
|
|
searx_extra/update/update_ahmia_blacklist.py
|
|
|
|
|
|
|
|
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
|
|
|
"""
|
|
|
|
with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
|
|
|
|
return f.read().split()
|
2020-10-26 20:40:24 +01:00
|
|
|
|
2021-06-06 08:13:50 +02: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')
|