forked from zaclys/searxng
[enh] duckduckgo autocomplete added
This commit is contained in:
parent
1e99cf2a0e
commit
cd3a52e189
|
@ -21,6 +21,16 @@ def dbpedia(query):
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def duckduckgo(query):
|
||||||
|
# wikipedia autocompleter
|
||||||
|
url = 'https://ac.duckduckgo.com/ac/?{0}&type=list'
|
||||||
|
|
||||||
|
resp = loads(get(url.format(urlencode(dict(q=query)))).text)
|
||||||
|
if len(resp) > 1:
|
||||||
|
return resp[1]
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
def google(query):
|
def google(query):
|
||||||
# google autocompleter
|
# google autocompleter
|
||||||
autocomplete_url = 'http://suggestqueries.google.com/complete/search?client=toolbar&' # noqa
|
autocomplete_url = 'http://suggestqueries.google.com/complete/search?client=toolbar&' # noqa
|
||||||
|
@ -48,6 +58,7 @@ def wikipedia(query):
|
||||||
|
|
||||||
|
|
||||||
backends = {'dbpedia': dbpedia,
|
backends = {'dbpedia': dbpedia,
|
||||||
|
'duckduckgo': duckduckgo,
|
||||||
'google': google,
|
'google': google,
|
||||||
'wikipedia': wikipedia
|
'wikipedia': wikipedia
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue