summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2020-02-23 14:54:10 +0000
committerGitHub <noreply@github.com>2020-02-23 14:54:10 +0000
commit09f4e2cd3138f7f19aa52c974729c791e48c20b2 (patch)
tree84fab673fb6a2b48d9ae3017cbfcb2c450cabc84 /searx
parent57efb45ce58ec180b89c5fd5943a2d52d974dc3e (diff)
parentf272781ab774a570a42a764070e4874484496d3e (diff)
downloadsearxng-09f4e2cd3138f7f19aa52c974729c791e48c20b2.tar.gz
searxng-09f4e2cd3138f7f19aa52c974729c791e48c20b2.zip
Merge pull request #1846 from piplongrun/autocomplete_swisscows
Add Swisscows autocomplete option
Diffstat (limited to 'searx')
-rw-r--r--searx/autocomplete.py9
-rw-r--r--searx/settings.yml2
2 files changed, 10 insertions, 1 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py
index ff8958500..00a9f9553 100644
--- a/searx/autocomplete.py
+++ b/searx/autocomplete.py
@@ -165,6 +165,14 @@ def startpage(query, lang):
return []
+def swisscows(query, lang):
+ # swisscows autocompleter
+ url = 'https://swisscows.ch/api/suggest?{query}&itemsCount=5'
+
+ resp = loads(get(url.format(query=urlencode({'query': query}))).text)
+ return resp
+
+
def qwant(query, lang):
# qwant autocompleter (additional parameter : lang=en_en&count=xxx )
url = 'https://api.qwant.com/api/suggest?{query}'
@@ -196,6 +204,7 @@ backends = {'dbpedia': dbpedia,
'duckduckgo': duckduckgo,
'google': google,
'startpage': startpage,
+ 'swisscows': swisscows,
'qwant': qwant,
'wikipedia': wikipedia
}
diff --git a/searx/settings.yml b/searx/settings.yml
index f39a5e32d..078d95b72 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -4,7 +4,7 @@ general:
search:
safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
- autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
+ autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
default_lang : "" # Default search language - leave blank to detect from browser information or use codes from 'languages.py'
ban_time_on_fail : 5 # ban time in seconds after engine errors
max_ban_time_on_fail : 120 # max ban time in seconds after engine errors