diff options
author | Bnyro <bnyro@tutanota.com> | 2023-08-23 15:24:42 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-08-27 17:25:26 +0200 |
commit | df71c24b2043195a94f3098f9b7371c6d6fb2dce (patch) | |
tree | 665fe98437fbefe690b71afce6786219a2de47a9 /searx/autocomplete.py | |
parent | 19300a5659d0752ed55cc8c419fe39d6dfb233f5 (diff) | |
download | searxng-df71c24b2043195a94f3098f9b7371c6d6fb2dce.tar.gz searxng-df71c24b2043195a94f3098f9b7371c6d6fb2dce.zip |
[mod] autocomplete.py: add support for mwmbl completions
Diffstat (limited to 'searx/autocomplete.py')
-rw-r--r-- | searx/autocomplete.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py index ad9903f36..4f674dca7 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -110,6 +110,16 @@ def google_complete(query, sxng_locale): return results +def mwmbl(query, _lang): + # mwmbl autocompleter + url = 'https://api.mwmbl.org/search/complete?{query}' + + results = get(url.format(query=urlencode({'q': query}))).json()[1] + + # results starting with `go:` are direct urls and not useful for auto completion + return [result for result in results if not result.startswith("go: ") and not result.startswith("search: ")] + + def seznam(query, _lang): # seznam search autocompleter url = 'https://suggest.seznam.cz/fulltext/cs?{query}' @@ -208,6 +218,7 @@ backends = { 'dbpedia': dbpedia, 'duckduckgo': duckduckgo, 'google': google_complete, + 'mwmbl': mwmbl, 'seznam': seznam, 'startpage': startpage, 'swisscows': swisscows, |