From e9afc4f8ce2df0b02a9b3d8664b66307255b056e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 30 Oct 2022 11:23:20 +0100 Subject: [mod] Startpage: reversed engineered & upgrade to data_type: traits_v1 One reason for the often seen CAPTCHA of the Startpage requests are the incomplete requests SearXNG sends to startpage.com: this patch is a complete new implementation of the ``request()`` function, reversed engineered from the Startpage's search form. The new implementation: - use traits of data_type: traits_v1 and drop deprecated data_type: supported_languages - adds time-range support - adds save-search support - fix searxng/searxng/issues 1884 - fix searxng/searxng/issues 1081 --> improvements to avoid CAPTCHA In preparation for more categories (News, Images, Videos ..) from Startpage, the variable ``startpage_categ`` was set up. The default value is ``web`` and other categories from Startpage are not yet implemented. Signed-off-by: Markus Heiser --- searx/autocomplete.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'searx/autocomplete.py') diff --git a/searx/autocomplete.py b/searx/autocomplete.py index 53e19905c..acea05c32 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -109,9 +109,9 @@ def seznam(query, _lang): ] -def startpage(query, lang): - # startpage autocompleter - lui = engines['startpage'].supported_languages.get(lang, 'english') # vintage / deprecated +def startpage(query, sxng_locale): + """Autocomplete from Startpage. Supports Startpage's languages""" + lui = engines['startpage'].traits.get_language(sxng_locale, 'english') url = 'https://startpage.com/suggestions?{query}' resp = get(url.format(query=urlencode({'q': query, 'segment': 'startpage.udog', 'lui': lui}))) data = resp.json() -- cgit v1.2.3