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.

[feat] engines: add support for search.ch/web (Swiss)

Bnyrobd73cc09eaec
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index 0f071bca0..428caddbe 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -292,7 +292,7 @@ def response(resp) -> EngineResults: # pylint: disable=too-many-branches
if 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(result, url_xpath), search_url)
title = extract_text(eval_xpath_list(result, title_xpath, min_len=1))
content = extract_text(eval_xpath_list(result, content_xpath))
tmp_result = {'url': url, 'title': title, 'content': content}
diff --git a/searx/settings.yml b/searx/settings.yml
index a509d94d9..893c018ed 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -2836,6 +2836,25 @@ engines:
shortcut: rehi
disabled: true
+ - name: searchch
+ engine: xpath
+ shortcut: sch
+ paging: true
+ search_url: https://search.ch/web/api/loadmore.html?path=/web/&q={query}&page={pageno}
+ results_xpath: //div[contains(@class, 'www-feed-web-result')]
+ # the URL looks like "//search.ch/web/r/redirect?...result!uffe8997e781e241d/https://example.com"
+ url_xpath: concat('https://', substring-after(.//a[contains(@class, 'sl-gus-result-url')]/@href, '://'))
+ title_xpath: .//a[contains(@class, 'sl-gus-result-title')]
+ content_xpath: .//div[contains(@class, 'sl-gus-result-body')]
+ language: "ch"
+ disabled: true
+ about:
+ website: https://search.ch/web
+ description: "Swiss search engine with its own Swiss index"
+ use_official_api: false
+ require_api_key: false
+ results: HTML
+
- name: searchzee
engine: json_engine
search_url: https://searchzee.com/api/search?q={query}&type=web&offset={pageno}