summaryrefslogtreecommitdiff
path: root/searx/autocomplete.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/autocomplete.py')
-rw-r--r--searx/autocomplete.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py
index 94913e8d8..527104041 100644
--- a/searx/autocomplete.py
+++ b/searx/autocomplete.py
@@ -110,7 +110,7 @@ def searx_bang(full_query):
return list(result_set)
-def dbpedia(query):
+def dbpedia(query, lang):
# dbpedia autocompleter, no HTTPS
autocomplete_url = 'http://lookup.dbpedia.org/api/search.asmx/KeywordSearch?'
@@ -126,7 +126,7 @@ def dbpedia(query):
return results
-def duckduckgo(query):
+def duckduckgo(query, lang):
# duckduckgo autocompleter
url = 'https://ac.duckduckgo.com/ac/?{0}&type=list'
@@ -136,11 +136,11 @@ def duckduckgo(query):
return []
-def google(query):
+def google(query, lang):
# google autocompleter
autocomplete_url = 'https://suggestqueries.google.com/complete/search?client=toolbar&'
- response = get(autocomplete_url + urlencode(dict(q=query)))
+ response = get(autocomplete_url + urlencode(dict(hl=lang, q=query)))
results = []
@@ -151,8 +151,8 @@ def google(query):
return results
-def startpage(query):
- # wikipedia autocompleter
+def startpage(query, lang):
+ # startpage autocompleter
url = 'https://startpage.com/do/suggest?{query}'
resp = get(url.format(query=urlencode({'query': query}))).text.split('\n')
@@ -161,11 +161,11 @@ def startpage(query):
return []
-def qwant(query):
+def qwant(query, lang):
# qwant autocompleter (additional parameter : lang=en_en&count=xxx )
url = 'https://api.qwant.com/api/suggest?{query}'
- resp = get(url.format(query=urlencode({'q': query})))
+ resp = get(url.format(query=urlencode({'q': query, 'lang': lang})))
results = []
@@ -178,9 +178,9 @@ def qwant(query):
return results
-def wikipedia(query):
+def wikipedia(query, lang):
# wikipedia autocompleter
- url = 'https://en.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json'
+ url = 'https://' + lang + '.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json'
resp = loads(get(url.format(urlencode(dict(search=query)))).text)
if len(resp) > 1: