mirror of
https://github.com/searxng/searxng.git
synced 2026-09-11 16:56:05 +00:00
[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.
This commit is contained in:
@@ -37,17 +37,13 @@ about = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
categories = []
|
categories = []
|
||||||
safeseach = True
|
safesearch = True
|
||||||
|
|
||||||
base_url = "https://luxxle.com"
|
base_url = "https://luxxle.com"
|
||||||
|
|
||||||
luxxle_categ = "search"
|
luxxle_categ = "search"
|
||||||
"""Supported categories: "search", "news", "images", "videos"."""
|
"""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"}
|
safe_search_map = {0: "Off", 1: "Moderate", 2: "Strict"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from urllib.parse import urlencode
|
|||||||
from lxml import html
|
from lxml import html
|
||||||
|
|
||||||
from searx.result_types import EngineResults
|
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.enginelib import EngineCache
|
||||||
from searx.exceptions import SearxEngineAPIException, SearxEngineAccessDeniedException
|
from searx.exceptions import SearxEngineAPIException, SearxEngineAccessDeniedException
|
||||||
from searx.network import get
|
from searx.network import get
|
||||||
@@ -44,8 +44,6 @@ SECRET_KEY_DB_KEY = "secret-key"
|
|||||||
CACHE: EngineCache
|
CACHE: EngineCache
|
||||||
"""Cache to store the secret API key for the engine."""
|
"""Cache to store the secret API key for the engine."""
|
||||||
|
|
||||||
enable_http2 = False
|
|
||||||
|
|
||||||
|
|
||||||
def setup(engine_settings: dict[str, t.Any]) -> bool:
|
def setup(engine_settings: dict[str, t.Any]) -> bool:
|
||||||
global CACHE # pylint: disable=global-statement
|
global CACHE # pylint: disable=global-statement
|
||||||
@@ -56,13 +54,7 @@ def setup(engine_settings: dict[str, t.Any]) -> bool:
|
|||||||
def _get_secret_key():
|
def _get_secret_key():
|
||||||
resp = get(
|
resp = get(
|
||||||
base_url,
|
base_url,
|
||||||
headers={
|
headers={"Referer": base_url},
|
||||||
# circumvents Cloudflare bot protections
|
|
||||||
"User-Agent": gen_useragent(),
|
|
||||||
"Referer": base_url,
|
|
||||||
"Sec-GPC": "1",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
@@ -105,8 +97,6 @@ def request(query, params):
|
|||||||
|
|
||||||
params["headers"]["secret-key"] = secret_key
|
params["headers"]["secret-key"] = secret_key
|
||||||
|
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
res = EngineResults()
|
res = EngineResults()
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ time_range_support = True
|
|||||||
safesearch_map = {0: 'off', 1: '1', 2: '1'}
|
safesearch_map = {0: 'off', 1: '1', 2: '1'}
|
||||||
time_range_map = {'day': '1d', 'week': '1w', 'month': '1m', 'year': '1y'}
|
time_range_map = {'day': '1d', 'week': '1w', 'month': '1m', 'year': '1y'}
|
||||||
|
|
||||||
# using http2 returns forbidden errors
|
|
||||||
enable_http2 = False
|
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
args = {
|
args = {
|
||||||
@@ -50,8 +47,6 @@ def request(query, params):
|
|||||||
# prevent automatic redirects to first page on pagination
|
# prevent automatic redirects to first page on pagination
|
||||||
params['allow_redirects'] = False
|
params['allow_redirects'] = False
|
||||||
|
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
def _image_result(result):
|
def _image_result(result):
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ about = {
|
|||||||
"require_api_key": False,
|
"require_api_key": False,
|
||||||
"results": "JSON",
|
"results": "JSON",
|
||||||
}
|
}
|
||||||
# otherwise all requests get blocked, probably HTTP2 fingerprinting
|
|
||||||
enable_http2 = False
|
|
||||||
|
|
||||||
base_url = "https://stocksnap.io"
|
base_url = "https://stocksnap.io"
|
||||||
cdn_url = "https://cdn.stocksnap.io"
|
cdn_url = "https://cdn.stocksnap.io"
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ about = {
|
|||||||
categories = ['images', 'icons']
|
categories = ['images', 'icons']
|
||||||
|
|
||||||
base_url = "https://uxwing.com"
|
base_url = "https://uxwing.com"
|
||||||
enable_http2 = False
|
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
params['url'] = f"{base_url}/?s={quote_plus(query)}"
|
params['url'] = f"{base_url}/?s={quote_plus(query)}"
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ web_base_url = "https://yep.com"
|
|||||||
safesearch = True
|
safesearch = True
|
||||||
safesearch_map = {0: "off", 1: "moderate", 2: "strict"}
|
safesearch_map = {0: "off", 1: "moderate", 2: "strict"}
|
||||||
|
|
||||||
enable_http2 = False
|
|
||||||
|
|
||||||
results_per_page = 20
|
results_per_page = 20
|
||||||
|
|
||||||
_IMPORT_RE = re.compile(r"import\"(.*?)\";")
|
_IMPORT_RE = re.compile(r"import\"(.*?)\";")
|
||||||
@@ -50,9 +48,6 @@ def request(query: str, params: "OnlineParams") -> None:
|
|||||||
{
|
{
|
||||||
"Referer": f"{web_base_url}/",
|
"Referer": f"{web_base_url}/",
|
||||||
"Origin": web_base_url,
|
"Origin": web_base_url,
|
||||||
"Sec-Fetch-Dest": "empty",
|
|
||||||
"Sec-Fetch-Mode": "cors",
|
|
||||||
"Sec-Fetch-Site": "same-site",
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user