Add Swisscows autocomplete option

This commit is contained in:
piplongrun 2020-02-14 19:19:24 +01:00 committed by GitHub
parent 7f224713e5
commit b136480546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -165,6 +165,14 @@ def startpage(query, lang):
return [] 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): def qwant(query, lang):
# qwant autocompleter (additional parameter : lang=en_en&count=xxx ) # qwant autocompleter (additional parameter : lang=en_en&count=xxx )
url = 'https://api.qwant.com/api/suggest?{query}' url = 'https://api.qwant.com/api/suggest?{query}'
@ -196,6 +204,7 @@ backends = {'dbpedia': dbpedia,
'duckduckgo': duckduckgo, 'duckduckgo': duckduckgo,
'google': google, 'google': google,
'startpage': startpage, 'startpage': startpage,
'swisscows': swisscows,
'qwant': qwant, 'qwant': qwant,
'wikipedia': wikipedia 'wikipedia': wikipedia
} }