diff options
author | Alexandre Flament <alex@al-f.net> | 2022-09-17 13:17:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 13:17:00 +0200 |
commit | b3708e4137cf66c7f2966e811c2fae907c28089a (patch) | |
tree | f9b16fb2fdb386ac39457895dd78f98c7d51c022 | |
parent | 07b7058cb79049a9c8e241045802577c92673a82 (diff) | |
parent | bc280915575131d5866a8d61814109de9d64b586 (diff) | |
download | searxng-b3708e4137cf66c7f2966e811c2fae907c28089a.tar.gz searxng-b3708e4137cf66c7f2966e811c2fae907c28089a.zip |
Merge pull request #1757 from LencoDigitexer/master
add yandex autocomplete
-rw-r--r-- | searx/autocomplete.py | 11 | ||||
-rw-r--r-- | searx/settings.yml | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py index f2faa4538..6fb5537a2 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -152,6 +152,16 @@ 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) + if len(resp) > 1: + return resp[1] + return [] + + backends = { 'dbpedia': dbpedia, 'duckduckgo': duckduckgo, @@ -162,6 +172,7 @@ backends = { 'qwant': qwant, 'wikipedia': wikipedia, 'brave': brave, + 'yandex': yandex, } 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: "" |