Merge bdc2852475a820631d997e29e7c9f7e7fae1e955 into b92748219504e67b18771b9831ffcebe76cca62f
This commit is contained in:
commit
742230fa98
@ -248,6 +248,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,6 +29,7 @@ about = {
|
|||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['general', 'web']
|
categories = ['general', 'web']
|
||||||
paging = True
|
paging = True
|
||||||
|
# ISSUE/FIXME: searx.engines.__init__ won't update this URL.
|
||||||
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
|
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
|
||||||
time_range_support = True
|
time_range_support = True
|
||||||
send_accept_language_header = True
|
send_accept_language_header = True
|
||||||
@ -46,8 +47,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 = 'https://duckduckgo.com' + 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):
|
||||||
@ -63,7 +69,7 @@ def get_region_code(lang, lang_list=None):
|
|||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
|
||||||
params['url'] = url
|
params['url'] = search_url
|
||||||
params['method'] = 'POST'
|
params['method'] = 'POST'
|
||||||
|
|
||||||
params['data']['q'] = query
|
params['data']['q'] = query
|
||||||
@ -119,7 +125,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…
x
Reference in New Issue
Block a user