summaryrefslogtreecommitdiff
path: root/searx/autocomplete.py
diff options
context:
space:
mode:
authorLencoDigitexer <addminuser258@gmail.com>2022-09-09 23:42:44 +0300
committerLencoDigitexer <addminuser258@gmail.com>2022-09-09 23:42:44 +0300
commit7b8d6015e38e30aa395cef761bc0bef0efc9b9c9 (patch)
treefdea46d32fd6f416c7e3d803cc8cca35fceb9138 /searx/autocomplete.py
parenteb3d185e66dea1add88ef8d3a3c6bb74b8a3b166 (diff)
downloadsearxng-7b8d6015e38e30aa395cef761bc0bef0efc9b9c9.tar.gz
searxng-7b8d6015e38e30aa395cef761bc0bef0efc9b9c9.zip
add yandex autocompleter
Diffstat (limited to 'searx/autocomplete.py')
-rw-r--r--searx/autocomplete.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py
index f2faa4538..55ee1cf27 100644
--- a/searx/autocomplete.py
+++ b/searx/autocomplete.py
@@ -152,6 +152,17 @@ def wikipedia(query, lang):
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 = {
'dbpedia': dbpedia,
'duckduckgo': duckduckgo,
@@ -162,6 +173,7 @@ backends = {
'qwant': qwant,
'wikipedia': wikipedia,
'brave': brave,
+ 'yandex': yandex,
}