add yandex autocompleter

This commit is contained in:
LencoDigitexer 2022-09-09 23:42:44 +03:00
parent eb3d185e66
commit 7b8d6015e3

View File

@ -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,
}