Browse Source

add yandex autocompleter

LencoDigitexer 2 years ago
parent
commit
7b8d6015e3
1 changed files with 12 additions and 0 deletions
  1. 12 0
      searx/autocomplete.py

+ 12 - 0
searx/autocomplete.py

@@ -152,6 +152,17 @@ def wikipedia(query, lang):
     return []
     return []
 
 
 
 
+def yandex(query, _lang):
+    # yandex autocompleter
+    url = "https://suggest.yandex.com/suggest-ff.cgi?{0}"
+
+    resp = loads(get(url.format(urlencode(dict(part=query)))).text)
+    print(resp)
+    if len(resp) > 1:
+        return resp[1]
+    return []
+
+
 backends = {
 backends = {
     'dbpedia': dbpedia,
     'dbpedia': dbpedia,
     'duckduckgo': duckduckgo,
     'duckduckgo': duckduckgo,
@@ -162,6 +173,7 @@ backends = {
     'qwant': qwant,
     'qwant': qwant,
     'wikipedia': wikipedia,
     'wikipedia': wikipedia,
     'brave': brave,
     'brave': brave,
+    'yandex': yandex,
 }
 }