From 7b8d6015e38e30aa395cef761bc0bef0efc9b9c9 Mon Sep 17 00:00:00 2001 From: LencoDigitexer Date: Fri, 9 Sep 2022 23:42:44 +0300 Subject: [PATCH] add yandex autocompleter --- searx/autocomplete.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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, }