forked from Ponysearch/Ponysearch
Merge pull request #1757 from LencoDigitexer/master
add yandex autocomplete
This commit is contained in:
commit
b3708e4137
2 changed files with 12 additions and 1 deletions
|
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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: ""
|
||||
|
|
Loading…
Reference in a new issue