From 7b8d6015e38e30aa395cef761bc0bef0efc9b9c9 Mon Sep 17 00:00:00 2001 From: LencoDigitexer Date: Fri, 9 Sep 2022 23:42:44 +0300 Subject: [PATCH 1/3] 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, } From 3f72a790887a2f2e7aaee3b0e2b51858cf6a00c2 Mon Sep 17 00:00:00 2001 From: LencoDigitexer Date: Fri, 9 Sep 2022 23:50:58 +0300 Subject: [PATCH 2/3] add yandex to autocomplete backends settings --- searx/settings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/settings.yml b/searx/settings.yml index 96ebd9715..197d7f949 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -23,7 +23,7 @@ brand: search: # Filter results. 0: None, 1: Moderate, 2: Strict safe_search: 0 - # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", + # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "yandex", # "seznam", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off # by default. autocomplete: "" From bc280915575131d5866a8d61814109de9d64b586 Mon Sep 17 00:00:00 2001 From: LencoDigitexer Date: Sat, 17 Sep 2022 11:25:14 +0300 Subject: [PATCH 3/3] remove the print statement --- searx/autocomplete.py | 1 - 1 file changed, 1 deletion(-) diff --git a/searx/autocomplete.py b/searx/autocomplete.py index 55ee1cf27..6fb5537a2 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -157,7 +157,6 @@ def yandex(query, _lang): 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 []