From 4781754dc46114b38a4773e917f5554d839aa03a Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 5 Sep 2026 19:24:54 +0200 Subject: [mod] engines: remove uses of `enable_http2 = False` This has only been needed because we were flagged by HTTP2 fingerprinting. Now, since we use curl cffi, we can bypass the fingerpinting, so we can use HTTP2 just fine without getting blocked. --- searx/engines/luxxle.py | 6 +----- searx/engines/pexels.py | 14 ++------------ searx/engines/pixabay.py | 5 ----- searx/engines/stocksnap.py | 2 -- searx/engines/uxwing.py | 2 -- searx/engines/yep.py | 5 ----- 6 files changed, 3 insertions(+), 31 deletions(-) diff --git a/searx/engines/luxxle.py b/searx/engines/luxxle.py index a7bc71f09..37da21d36 100644 --- a/searx/engines/luxxle.py +++ b/searx/engines/luxxle.py @@ -37,17 +37,13 @@ about = { } categories = [] -safeseach = True +safesearch = True base_url = "https://luxxle.com" luxxle_categ = "search" """Supported categories: "search", "news", "images", "videos".""" -# otherwise all requests get blocked (http2-fingerprinted probably) -enable_http2 = False - - safe_search_map = {0: "Off", 1: "Moderate", 2: "Strict"} diff --git a/searx/engines/pexels.py b/searx/engines/pexels.py index 82d4d702a..67bbe4648 100644 --- a/searx/engines/pexels.py +++ b/searx/engines/pexels.py @@ -8,7 +8,7 @@ from urllib.parse import urlencode from lxml import html from searx.result_types import EngineResults -from searx.utils import eval_xpath_list, gen_useragent +from searx.utils import eval_xpath_list from searx.enginelib import EngineCache from searx.exceptions import SearxEngineAPIException, SearxEngineAccessDeniedException from searx.network import get @@ -44,8 +44,6 @@ SECRET_KEY_DB_KEY = "secret-key" CACHE: EngineCache """Cache to store the secret API key for the engine.""" -enable_http2 = False - def setup(engine_settings: dict[str, t.Any]) -> bool: global CACHE # pylint: disable=global-statement @@ -56,13 +54,7 @@ def setup(engine_settings: dict[str, t.Any]) -> bool: def _get_secret_key(): resp = get( base_url, - headers={ - # circumvents Cloudflare bot protections - "User-Agent": gen_useragent(), - "Referer": base_url, - "Sec-GPC": "1", - "Connection": "keep-alive", - }, + headers={"Referer": base_url}, ) if resp.status_code != 200: @@ -105,8 +97,6 @@ def request(query, params): params["headers"]["secret-key"] = secret_key - return params - def response(resp): res = EngineResults() diff --git a/searx/engines/pixabay.py b/searx/engines/pixabay.py index 3a01d8af0..64c35a36f 100644 --- a/searx/engines/pixabay.py +++ b/searx/engines/pixabay.py @@ -27,9 +27,6 @@ time_range_support = True safesearch_map = {0: 'off', 1: '1', 2: '1'} time_range_map = {'day': '1d', 'week': '1w', 'month': '1m', 'year': '1y'} -# using http2 returns forbidden errors -enable_http2 = False - def request(query, params): args = { @@ -50,8 +47,6 @@ def request(query, params): # prevent automatic redirects to first page on pagination params['allow_redirects'] = False - return params - def _image_result(result): return { diff --git a/searx/engines/stocksnap.py b/searx/engines/stocksnap.py index 3c532d0bb..85eeccbda 100644 --- a/searx/engines/stocksnap.py +++ b/searx/engines/stocksnap.py @@ -21,8 +21,6 @@ about = { "require_api_key": False, "results": "JSON", } -# otherwise all requests get blocked, probably HTTP2 fingerprinting -enable_http2 = False base_url = "https://stocksnap.io" cdn_url = "https://cdn.stocksnap.io" diff --git a/searx/engines/uxwing.py b/searx/engines/uxwing.py index 59bb75afc..fd845f980 100644 --- a/searx/engines/uxwing.py +++ b/searx/engines/uxwing.py @@ -17,12 +17,10 @@ about = { categories = ['images', 'icons'] base_url = "https://uxwing.com" -enable_http2 = False def request(query, params): params['url'] = f"{base_url}/?s={quote_plus(query)}" - return params def response(resp): diff --git a/searx/engines/yep.py b/searx/engines/yep.py index e87a1bef2..81c60d627 100644 --- a/searx/engines/yep.py +++ b/searx/engines/yep.py @@ -30,8 +30,6 @@ web_base_url = "https://yep.com" safesearch = True safesearch_map = {0: "off", 1: "moderate", 2: "strict"} -enable_http2 = False - results_per_page = 20 _IMPORT_RE = re.compile(r"import\"(.*?)\";") @@ -50,9 +48,6 @@ def request(query: str, params: "OnlineParams") -> None: { "Referer": f"{web_base_url}/", "Origin": web_base_url, - "Sec-Fetch-Dest": "empty", - "Sec-Fetch-Mode": "cors", - "Sec-Fetch-Site": "same-site", } ) -- cgit v1.2.3