[feat] engines: add google cse engine (#6364)

Adds a new google cse engine as an alternative to the currently broken html
google engine.

It works by generating a token which is cached for 1 hour and it only uses the
public CSE id from blackle.com.  We do have two others but I think just
hardcoding one will be enough.

Will be broken in 2027 due to google deprecating it but I it will be good while
it lasts.

I found I can get up to 20 results per page. Setting safesearch and language
works and I just copied the traits from the google engine.

Also set old google engine as inactive as it is completely broken for now.
This commit is contained in:
vojkovic
2026-07-04 11:58:28 +00:00
committed by Markus Heiser
parent 747cec4c23
commit 1cdf01a719
4 changed files with 172 additions and 5 deletions

View File

@@ -131,8 +131,8 @@ def fetch_traits_map() -> EngineTraitsMap:
def filter_locales(traits_map: EngineTraitsMap) -> set[str]:
"""Filter language & region tags by a threshold."""
min_eng_per_region = 18
min_eng_per_lang = 23
min_eng_per_region = 19
min_eng_per_lang = 24
_: dict[str, int] = {}
for eng in traits_map.values():