Compare commits

..

4 Commits

Author SHA1 Message Date
Alexandre Flament b3708e4137
Merge pull request #1757 from LencoDigitexer/master
add yandex autocomplete
2022-09-17 13:17:00 +02:00
LencoDigitexer bc28091557 remove the print statement 2022-09-17 11:25:14 +03:00
LencoDigitexer 3f72a79088 add yandex to autocomplete backends settings 2022-09-09 23:50:58 +03:00
LencoDigitexer 7b8d6015e3 add yandex autocompleter 2022-09-09 23:42:44 +03:00
2 changed files with 12 additions and 1 deletions

View File

@ -152,6 +152,16 @@ def wikipedia(query, lang):
return [] 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 = { backends = {
'dbpedia': dbpedia, 'dbpedia': dbpedia,
'duckduckgo': duckduckgo, 'duckduckgo': duckduckgo,
@ -162,6 +172,7 @@ backends = {
'qwant': qwant, 'qwant': qwant,
'wikipedia': wikipedia, 'wikipedia': wikipedia,
'brave': brave, 'brave': brave,
'yandex': yandex,
} }

View File

@ -23,7 +23,7 @@ brand:
search: search:
# Filter results. 0: None, 1: Moderate, 2: Strict # Filter results. 0: None, 1: Moderate, 2: Strict
safe_search: 0 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 # "seznam", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
# by default. # by default.
autocomplete: "" autocomplete: ""