logo

searx

My custom branche(s) on searx, a meta-search engine
commit: cd3a52e18965a3077b4fad86f327f772e02b5a6a
parent: 1e99cf2a0e541a3d2df0104d64fadf955bbccc20
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Sun,  7 Sep 2014 23:56:06 +0200

[enh] duckduckgo autocomplete added

Diffstat:

Msearx/autocomplete.py11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/searx/autocomplete.py b/searx/autocomplete.py @@ -21,6 +21,16 @@ def dbpedia(query): 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): # google autocompleter autocomplete_url = 'http://suggestqueries.google.com/complete/search?client=toolbar&' # noqa @@ -48,6 +58,7 @@ def wikipedia(query): backends = {'dbpedia': dbpedia, + 'duckduckgo': duckduckgo, 'google': google, 'wikipedia': wikipedia }