mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Add onion url to ddg, update ping_url when using_tor_proxy
This commit is contained in:
parent
b6d59decda
commit
cb013affef
2 changed files with 11 additions and 4 deletions
|
@ -239,6 +239,8 @@ def update_attributes_for_tor(engine: Engine) -> bool:
|
||||||
if using_tor_proxy(engine) and hasattr(engine, 'onion_url'):
|
if using_tor_proxy(engine) and hasattr(engine, 'onion_url'):
|
||||||
engine.search_url = engine.onion_url + getattr(engine, 'search_path', '')
|
engine.search_url = engine.onion_url + getattr(engine, 'search_path', '')
|
||||||
engine.timeout += settings['outgoing'].get('extra_proxy_timeout', 0)
|
engine.timeout += settings['outgoing'].get('extra_proxy_timeout', 0)
|
||||||
|
if hasattr(engine, 'ping_url'):
|
||||||
|
engine.ping_url = engine.onion_url + getattr(engine, 'ping_path', '')
|
||||||
|
|
||||||
|
|
||||||
def is_missing_required_attributes(engine):
|
def is_missing_required_attributes(engine):
|
||||||
|
|
|
@ -29,7 +29,7 @@ about = {
|
||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['general', 'web']
|
categories = ['general', 'web']
|
||||||
paging = True
|
paging = True
|
||||||
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
|
supported_languages_url = 'https://duckduckgo.com/util/u588.js' # <-- ISSUE/FIXME: searx.engines.__init__ won't update this URL.
|
||||||
time_range_support = True
|
time_range_support = True
|
||||||
|
|
||||||
language_aliases = {
|
language_aliases = {
|
||||||
|
@ -45,8 +45,13 @@ language_aliases = {
|
||||||
time_range_dict = {'day': 'd', 'week': 'w', 'month': 'm', 'year': 'y'}
|
time_range_dict = {'day': 'd', 'week': 'w', 'month': 'm', 'year': 'y'}
|
||||||
|
|
||||||
# search-url
|
# search-url
|
||||||
url = 'https://lite.duckduckgo.com/lite'
|
base_url = 'https://lite.duckduckgo.com'
|
||||||
url_ping = 'https://duckduckgo.com/t/sl_l'
|
onion_url = 'https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion'
|
||||||
|
search_path = '/lite?'
|
||||||
|
ping_path = '/t/sl_l'
|
||||||
|
|
||||||
|
search_url = base_url + search_path
|
||||||
|
ping_url = base_url + ping_path
|
||||||
|
|
||||||
# match query's language to a region code that duckduckgo will accept
|
# match query's language to a region code that duckduckgo will accept
|
||||||
def get_region_code(lang, lang_list=None):
|
def get_region_code(lang, lang_list=None):
|
||||||
|
@ -118,7 +123,7 @@ def request(query, params):
|
||||||
def response(resp):
|
def response(resp):
|
||||||
|
|
||||||
headers_ping = dict_subset(resp.request.headers, ['User-Agent', 'Accept-Encoding', 'Accept', 'Cookie'])
|
headers_ping = dict_subset(resp.request.headers, ['User-Agent', 'Accept-Encoding', 'Accept', 'Cookie'])
|
||||||
get(url_ping, headers=headers_ping)
|
get(ping_url, headers=headers_ping)
|
||||||
|
|
||||||
if resp.status_code == 303:
|
if resp.status_code == 303:
|
||||||
return []
|
return []
|
||||||
|
|
Loading…
Add table
Reference in a new issue