Load Engines

This module implements the engine loader.

Load and initialize the engines, see load_engines() and register engine_shortcuts.

usage:

load_engines( settings['engines'] )
searx.engines.ENGINE_DEFAULT_ARGS = {'categories': ['general'], 'disabled': False, 'display_error_messages': True, 'enable_http': False, 'engine_type': 'online', 'inactive': False, 'language_aliases': {}, 'paging': False, 'safesearch': False, 'shortcut': '-', 'supported_languages': [], 'time_range_support': False, 'timeout': 3.0, 'tokens': []}

Defaults for the namespace of an engine module, see load_engine()

searx.engines.engine_shortcuts = {'1337x': '1337x', '1x': '1x', 'ai': 'archive is', 'al': 'arch linux wiki', 'apkm': 'apk mirror', 'arc': 'artic', 'arx': 'arxiv', 'bb': 'bitbucket', 'bc': 'bandcamp', 'bi': 'bing', 'bii': 'bing images', 'bin': 'bing news', 'biv': 'bing videos', 'brave': 'brave', 'bt': 'btdigg', 'c3tv': 'ccc-tv', 'cb': 'codeberg', 'cc': 'currency', 'cce': 'ccengine', 'cr': 'crossref', 'da': 'deviantart', 'dc': 'dictzone', 'ddd': 'ddg definitions', 'ddg': 'duckduckgo', 'ddi': 'duckduckgo images', 'def': 'wordnik', 'dg': 'digg', 'dh': 'docker hub', 'dm': 'dailymotion', 'du': 'duden', 'dz': 'deezer', 'et': 'etymonline', 'eto': 'etools', 'ew': 'erowid', 'fd': 'fdroid', 'fl': 'flickr', 'frk': 'frinkiac', 'frl': 'framalibre', 'fsd': 'free software directory', 'gb': 'gigablast', 'ge': 'gentoo', 'gen': 'genius', 'gh': 'github', 'gl': 'gitlab', 'go': 'google', 'goi': 'google images', 'gon': 'google news', 'gos': 'google scholar', 'gov': 'google videos', 'gpa': 'google play apps', 'gpm': 'google play movies', 'gpod': 'gpodder', 'gt': 'geektimes', 'habr': 'habrahabr', 'ho': 'hoogle', 'in': 'ina', 'iv': 'invidious', 'kc': 'kickass', 'lg': 'library genesis', 'lo': 'lobste.rs', 'loc': 'library of congress', 'lyrics': 'azlyrics', 'ma': 'microsoft academic', 'man': 'mankier', 'mc': 'mixcloud', 'mjk': 'mojeek', 'mvw': 'mediathekviewweb', 'npm': 'npm', 'nt': 'nyaa', 'nvr': 'naver', 'oad': 'openairedatasets', 'oap': 'openairepublications', 'or': 'openrepos', 'osm': 'openstreetmap', 'pack': 'packagist', 'pdb': 'pdbe', 'ph': 'photon', 'ptb': 'peertube', 'pub': 'pubmed', 'pypi': 'pypi', 'qw': 'qwant', 'qwi': 'qwant images', 'qwn': 'qwant news', 'qwv': 'qwant videos', 'rbg': 'rubygems', 're': 'reddit', 'ru': 'rumble', 'sc': 'soundcloud', 'scc': 'searchcode code', 'se': 'semantic scholar', 'sep': 'sepiasearch', 'sjp': 'słownik języka polskiego', 'solid': 'solidtorrents', 'sp': 'startpage', 'st': 'stackoverflow', 'szn': 'seznam', 'tl': 'mymemory translated', 'tpb': 'piratebay', 'tt': 'tokyotoshokan', 'us': 'unsplash', 'vm': 'vimeo', 'wa': 'wolframalpha', 'wb': 'wikibooks', 'wd': 'wikidata', 'whale': 'whaleslide', 'wib': 'wiby', 'wkmn': 'wikimini', 'wn': 'wikinews', 'woxi': 'woxikon.de synonyme', 'wp': 'wikipedia', 'wq': 'wikiquote', 'ws': 'wikisource', 'wt': 'wiktionary', 'wv': 'wikiversity', 'wy': 'wikivoyage', 'ygg': 'yggtorrent', 'yh': 'yahoo', 'yhn': 'yahoo news', 'yt': 'youtube'}

Simple map of registered shortcuts to name of the engine (or None).

engine_shortcuts[engine.shortcut] = engine.name
searx.engines.is_missing_required_attributes(engine)[source]

An attribute is required when its name doesn’t start with _ (underline). Required attributes must not be None.

searx.engines.load_engine(engine_data)[source]

Load engine from engine_data.

Parameters

engine_data (dict) – Attributes from YAML settings:engines/<engine>

Returns

initialized namespace of the <engine>.

  1. create a namespace and load module of the <engine>

  2. update namespace with the defaults from ENGINE_DEFAULT_ARGS

  3. update namespace with values from engine_data

If engine is active, return namespace of the engine, otherwise return None.

This function also returns None if initialization of the namespace fails for one of the following reasons:

searx.engines.load_engines(engine_list)[source]

usage: engine_list = settings['engines']