[fix] json, xpath engine: rename safe_search_support option to safesearch (#6143)

This commit is contained in:
Bnyro
2026-05-26 11:38:07 +02:00
committed by GitHub
parent f1a22dec9e
commit 1574939441
2 changed files with 6 additions and 8 deletions
+3 -4
View File
@@ -29,7 +29,7 @@ Time Range:
Safe-Search: Safe-Search:
- :py:obj:`safe_search_support` - :py:obj:`safesearch`
- :py:obj:`safe_search_map` - :py:obj:`safe_search_map`
Response: Response:
@@ -103,7 +103,7 @@ Replacements are:
``{safe_search}``: ``{safe_search}``:
Safe-search :py:obj:`URL parameter <safe_search_map>` if engine Safe-search :py:obj:`URL parameter <safe_search_map>` if engine
:py:obj:`supports safe-search <safe_search_support>`. The ``{safe_search}`` :py:obj:`supports safe-search <safesearch>`. The ``{safe_search}``
replacement is taken from the :py:obj:`safes_search_map`. Filter results:: replacement is taken from the :py:obj:`safes_search_map`. Filter results::
0: none, 1: moderate, 2:strict 0: none, 1: moderate, 2:strict
@@ -236,7 +236,7 @@ time_range_map = {
year: 365 year: 365
''' '''
safe_search_support = False safesearch = False
'''Engine supports safe-search.''' '''Engine supports safe-search.'''
safe_search_map = {0: '&filter=none', 1: '&filter=moderate', 2: '&filter=strict'} safe_search_map = {0: '&filter=none', 1: '&filter=moderate', 2: '&filter=strict'}
@@ -286,7 +286,6 @@ def do_query(data, q): # pylint: disable=invalid-name
qkey = q[0] qkey = q[0]
for key, value in iterate(data): for key, value in iterate(data):
if len(q) == 1: if len(q) == 1:
if key == qkey: if key == qkey:
ret.append(value) ret.append(value)
+3 -4
View File
@@ -31,7 +31,7 @@ Time Range:
Safe-Search: Safe-Search:
- :py:obj:`safe_search_support` - :py:obj:`safesearch`
- :py:obj:`safe_search_map` - :py:obj:`safe_search_map`
Response: Response:
@@ -100,7 +100,7 @@ Replacements are:
``{safe_search}``: ``{safe_search}``:
Safe-search :py:obj:`URL parameter <safe_search_map>` if engine Safe-search :py:obj:`URL parameter <safe_search_map>` if engine
:py:obj:`supports safe-search <safe_search_support>`. The ``{safe_search}`` :py:obj:`supports safe-search <safesearch>`. The ``{safe_search}``
replacement is taken from the :py:obj:`safes_search_map`. Filter results:: replacement is taken from the :py:obj:`safes_search_map`. Filter results::
0: none, 1: moderate, 2:strict 0: none, 1: moderate, 2:strict
@@ -205,7 +205,7 @@ time_range_map = {
year: 365 year: 365
''' '''
safe_search_support = False safesearch = False
'''Engine supports safe-search.''' '''Engine supports safe-search.'''
safe_search_map = {0: '&filter=none', 1: '&filter=moderate', 2: '&filter=strict'} safe_search_map = {0: '&filter=none', 1: '&filter=moderate', 2: '&filter=strict'}
@@ -280,7 +280,6 @@ def response(resp) -> EngineResults: # pylint: disable=too-many-branches
if results_xpath: if results_xpath:
for result in eval_xpath_list(dom, results_xpath): for result in eval_xpath_list(dom, results_xpath):
url = extract_url(eval_xpath_list(result, url_xpath, min_len=1), search_url) url = extract_url(eval_xpath_list(result, url_xpath, min_len=1), search_url)
title = extract_text(eval_xpath_list(result, title_xpath, min_len=1)) title = extract_text(eval_xpath_list(result, title_xpath, min_len=1))
content = extract_text(eval_xpath_list(result, content_xpath)) content = extract_text(eval_xpath_list(result, content_xpath))