diff options
author | piplongrun <piplongrun@users.noreply.github.com> | 2020-02-14 19:19:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 19:19:24 +0100 |
commit | b136480546c7b14958261338c27f0b2a97ea0aac (patch) | |
tree | aa35906d4b018bb0ef980b9697512be480d1121e /searx/autocomplete.py | |
parent | 7f224713e5bfdb22b543129d9ada698b8cefd6a3 (diff) | |
download | searxng-b136480546c7b14958261338c27f0b2a97ea0aac.tar.gz searxng-b136480546c7b14958261338c27f0b2a97ea0aac.zip |
Add Swisscows autocomplete option
Diffstat (limited to 'searx/autocomplete.py')
-rw-r--r-- | searx/autocomplete.py | 9 |
1 files changed, 9 insertions, 0 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 } |