Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[enh] Allow passing headers/cookies from settings.yml

Allen155333f62568
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index 2737bf94a..7a41d9475 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -85,6 +85,11 @@ suggestion_xpath = ''
cached_xpath = ''
cached_url = ''
+cookies = {}
+headers = {}
+'''Some engines might offer different result based on cookies or headers.
+Possible use-case: To set safesearch cookie or header to moderate.'''
+
paging = False
'''Engine supports paging [True or False].'''
@@ -166,6 +171,9 @@ def request(query, params):
'safe_search': safe_search,
}
+ params['cookies'] = cookies
+ params['headers'] = headers
+
params['url'] = search_url.format(**fargs)
params['soft_max_redirects'] = soft_max_redirects