From ffcebf5e1260ec6c468efce78ec3fbccb114ba3f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 17 May 2021 15:04:55 +0200 Subject: [PATCH 1/2] [enh] xpath engine - add request parameter 'soft_max_redirects' Make 'soft_max_redirects' configurable per Xpath engine:: - name : engine : xpath soft_max_redirects: 1 ... Signed-off-by: Markus Heiser --- searx/engines/xpath.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 612f69abd..b215c2ba1 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -14,6 +14,7 @@ suggestion_xpath = '' results_xpath = '' cached_xpath = '' cached_url = '' +soft_max_redirects = 0 # parameters for engines with paging support # @@ -33,6 +34,7 @@ def request(query, params): params['url'] = search_url.format(**fp) params['query'] = query + params['soft_max_redirects'] = soft_max_redirects return params From 57cdf180feaf43fa7596c7a38816ebbfc49aad35 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 17 May 2021 15:21:53 +0200 Subject: [PATCH 2/2] [fix] engine archive is - search_url has been changed BTW: set soft_max_redirects from *archive is* by 1, to prevent logging:: DEBUG:httpx._client:HTTP Request: GET https://archive.is/search/?q=www.python.org "HTTP/2 302 Found" DEBUG:httpx._client:HTTP Request: GET https://archive.is/www.python.org "HTTP/2 200 OK" DEBUG:searx:archive is: ErrorContext('searx/search/processors/online.py', 110, 'count_error(self.engine_name,', None, '1 redirects, maximum: 0', ('200', 'OK', 'archive.is')) True Signed-off-by: Markus Heiser --- searx/settings.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/searx/settings.yml b/searx/settings.yml index 435a638e8..b0c425e4f 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -170,7 +170,7 @@ engines: - name : archive is engine : xpath - search_url : https://archive.is/{query} + search_url : https://archive.is/search/?q={query} url_xpath : (//div[@class="TEXT-BLOCK"]/a)/@href title_xpath : (//div[@class="TEXT-BLOCK"]/a) content_xpath : //div[@class="TEXT-BLOCK"]/ul/li @@ -178,6 +178,7 @@ engines: timeout : 7.0 disabled : True shortcut : ai + soft_max_redirects: 1 about: website: https://archive.is/ wikidata_id: Q13515725