[mod] qwant - add safesearch option

Closes: https://github.com/searxng/searxng/issues/1640
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2022-08-12 18:37:46 +02:00
parent 6579d6d558
commit 27385e7898

View File

@ -52,6 +52,9 @@ paging = True
supported_languages_url = about['website'] supported_languages_url = about['website']
qwant_categ = None # web|news|inages|videos qwant_categ = None # web|news|inages|videos
safesearch = True
safe_search_map = {0: '&safesearch=0', 1: '&safesearch=1', 2: '&safesearch=2'}
# fmt: off # fmt: off
qwant_news_locales = [ qwant_news_locales = [
'ca_ad', 'ca_es', 'ca_fr', 'co_fr', 'de_at', 'de_ch', 'de_de', 'en_au', 'ca_ad', 'ca_es', 'ca_fr', 'co_fr', 'de_at', 'de_ch', 'de_de', 'en_au',
@ -95,6 +98,9 @@ def request(query, params):
q_locale = get_engine_locale(params['language'], supported_languages, default='en_US') q_locale = get_engine_locale(params['language'], supported_languages, default='en_US')
params['url'] += '&locale=' + q_locale params['url'] += '&locale=' + q_locale
# add safesearch option
params['url'] += safe_search_map.get(params['safesearch'], '')
params['raise_for_httperror'] = False params['raise_for_httperror'] = False
return params return params