mirror of
https://github.com/searxng/searxng.git
synced 2025-08-03 02:22:22 +02:00
[enh] Add onions category with Ahmia, Not Evil and Torch
Xpath engine and results template changed to account for the fact that archive.org doesn't cache .onions, though some onion engines migth have their own cache. Disabled by default. Can be enabled by setting the SOCKS proxies to wherever Tor is listening and setting using_tor_proxy as True. Requires Tor and updating packages. To avoid manually adding the timeout on each engine, you can set extra_proxy_timeout to account for Tor's (or whatever proxy used) extra time.
This commit is contained in:
parent
0a44fa8bb7
commit
c3daa08537
11 changed files with 399 additions and 14 deletions
|
@ -142,6 +142,17 @@ def load_engine(engine_data):
|
|||
engine.stats['page_load_time'] = 0
|
||||
engine.stats['page_load_count'] = 0
|
||||
|
||||
# tor related settings
|
||||
if settings['outgoing'].get('using_tor_proxy'):
|
||||
# use onion url if using tor.
|
||||
if hasattr(engine, 'onion_url'):
|
||||
engine.search_url = engine.onion_url + getattr(engine, 'search_path', '')
|
||||
elif 'onions' in engine.categories:
|
||||
# exclude onion engines if not using tor.
|
||||
return None
|
||||
|
||||
engine.timeout += settings['outgoing'].get('extra_proxy_timeout', 0)
|
||||
|
||||
for category_name in engine.categories:
|
||||
categories.setdefault(category_name, []).append(engine)
|
||||
|
||||
|
@ -252,8 +263,9 @@ def get_engines_stats(preferences):
|
|||
|
||||
|
||||
def load_engines(engine_list):
|
||||
global engines
|
||||
global engines, engine_shortcuts
|
||||
engines.clear()
|
||||
engine_shortcuts.clear()
|
||||
for engine_data in engine_list:
|
||||
engine = load_engine(engine_data)
|
||||
if engine is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue