diff options
| author | Bnyro <bnyro@tutanota.com> | 2026-06-06 18:37:27 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2026-06-13 18:37:57 +0200 |
| commit | 0608dfa4d1a09e7e19bdf863820f57df151c7d25 (patch) | |
| tree | b1c8e213d9c9e5848e899744d92bcbe64134bda3 /searx/autocomplete.py | |
| parent | 1184b3212fdd04d45b0e53a5dab3b2c3cbbb3820 (diff) | |
[feat] autocomplete: add privacywall autocompleter (#6211)
Diffstat (limited to 'searx/autocomplete.py')
| -rw-r--r-- | searx/autocomplete.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py index 8b7285376..4e66dff22 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -179,6 +179,23 @@ def naver(query: str, _sxng_locale: str) -> list[str]: return results +def privacywall(query: str, sxng_locale: str) -> list[str]: + # Privacywall search autocompleter + country = None + if "-" in sxng_locale: + country = sxng_locale.split("-")[1] + args = {'q': query, 'cc': country} + + url = f"https://www.privacywall.org/search/secure/suggestions.php?{urlencode(args)}" + response = get(url) + + if not response.ok: + return [] + + data: list[list[str]] = response.json() + return data[1] + + def qihu360search(query: str, _sxng_locale: str) -> list[str]: # 360Search search autocompleter url = f"https://sug.so.360.cn/suggest?{urlencode({'format': 'json', 'word': query})}" @@ -361,6 +378,7 @@ backends: dict[str, t.Callable[[str, str], list[str]]] = { 'google': google_complete, 'mwmbl': mwmbl, 'naver': naver, + 'privacywall': privacywall, 'quark': quark, 'qwant': qwant, 'seznam': seznam, |
