mirror of
https://github.com/searxng/searxng.git
synced 2026-07-31 20:31:31 +00:00
Compare commits
2 Commits
04a6ab12fb
...
176079977d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
176079977d | ||
|
|
f3f13519ff |
@@ -36,6 +36,21 @@ def post(*args, **kwargs):
|
||||
return http_post(*args, **kwargs)
|
||||
|
||||
|
||||
def baidu(query, _lang):
|
||||
# baidu search autocompleter
|
||||
base_url = "https://www.baidu.com/sugrec?"
|
||||
response = get(base_url + urlencode({'ie': 'utf-8', 'json': 1, 'prod': 'pc', 'wd': query}))
|
||||
|
||||
results = []
|
||||
|
||||
if response.ok:
|
||||
data = response.json()
|
||||
if 'g' in data:
|
||||
for item in data['g']:
|
||||
results.append(item['q'])
|
||||
return results
|
||||
|
||||
|
||||
def brave(query, _lang):
|
||||
# brave search autocompleter
|
||||
url = 'https://search.brave.com/api/suggest?'
|
||||
@@ -238,17 +253,18 @@ def yandex(query, _lang):
|
||||
|
||||
|
||||
backends = {
|
||||
'baidu': baidu,
|
||||
'brave': brave,
|
||||
'dbpedia': dbpedia,
|
||||
'duckduckgo': duckduckgo,
|
||||
'google': google_complete,
|
||||
'mwmbl': mwmbl,
|
||||
'qwant': qwant,
|
||||
'seznam': seznam,
|
||||
'startpage': startpage,
|
||||
'stract': stract,
|
||||
'swisscows': swisscows,
|
||||
'qwant': qwant,
|
||||
'wikipedia': wikipedia,
|
||||
'brave': brave,
|
||||
'yandex': yandex,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user