diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2021-11-05 11:35:03 +0100 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2021-11-05 11:35:03 +0100 |
| commit | b9c458bafa55f0d214086315894cc6c2c5e1c0b0 (patch) | |
| tree | 7862cea8f82fac140b660c6ce5bdbcf9f64a34ef /config/services/web | |
| parent | abc56185c2fa9402118f392bf2b7d1f3e496fd3a (diff) | |
add custom wikipedia engine
Diffstat (limited to 'config/services/web')
| -rw-r--r-- | config/services/web/searx/searx/engines.nix | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/config/services/web/searx/searx/engines.nix b/config/services/web/searx/searx/engines.nix index 7c97936..4018ab8 100644 --- a/config/services/web/searx/searx/engines.nix +++ b/config/services/web/searx/searx/engines.nix @@ -11,11 +11,14 @@ let disable = overrideDisabled true; makeSearchUrl = { baseUrl, queryKeyword ? "query", pageKeyword ? null - , preventRedirect ? false }: + , preventRedirect ? false, extraParameters ? { } }: baseUrl + "?${queryKeyword}={query}" # an invisible whitespace is added at the end of the query to prevent redirections + (optionalString preventRedirect "%E2%80%8E") - + (optionalString (pageKeyword != null) "&${pageKeyword}={pageno}"); + + (optionalString (pageKeyword != null) "&${pageKeyword}={pageno}") + + (concatStrings + (mapAttrsToList (name: value: "&${name}=${builtins.toString value}") + extraParameters)); in { services.searx.settings.engines = (disable [ # general @@ -111,5 +114,29 @@ in { results = "HTML"; }; } + { + name = "wikipedia search"; + engine = "xpath"; + search_url = { + baseUrl = "https://fr.wikipedia.org/w/index.php"; + queryKeyword = "search"; + extraParameters = { fulltext = 1; }; + }; + results_xpath = ''ul[@class="mw-search-results"]/li''; + url_xpath = ''./div[@class="mw-search-result-heading"]/a/@href''; + title_xpath = ''./div[@class="mw-search-result-heading"]/a''; + content_xpath = ''./div[@class="searchresult"]''; + shortcut = "w"; + categories = "general"; + disabled = true; + about = { + website = "https://www.wikipedia.org/"; + wikidata_id = "Q52"; + official_api_documentation = "https://en.wikipedia.org/api/"; + use_official_api = false; + require_api_key = false; + results = "HTML"; + }; + } ]; } |
