fix: disabled HEADLESS mode by default and updated dependencies

This commit is contained in:
Alvaro Santos Andres
2025-07-25 13:51:19 +02:00
parent 6fa0658f4c
commit 39f758859d
6 changed files with 28 additions and 18 deletions
+2 -1
View File
@@ -35,7 +35,8 @@ An alternative to [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr) a
| Environment Variable | Default | Description |
| -------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `USE_HEADLESS` | `SeleniumBase default` | Use headless chromium. |
| `USE_HEADLESS` | `False` | Use headless chromium. |
| `USE_XVFB` | `SeleniumBase default` | Use activate the special virtual display. |
| `PROXY` | None | Proxy to use in format: `protocol://username:password@host:port`. [SOCKS5 with authentication is not supported by Chrome](https://stackoverflow.com/questions/75602916/connection-to-private-proxy-socks5-with-chrome-webrequest-onauthrequired-and), see `compose.yaml` file for a workaround |
## Proxy Recommendation
+4 -4
View File
@@ -8,10 +8,10 @@ version = "0.1.0"
description = "API for getting cookies for Cloudflare challenges"
readme = "README.md"
dependencies = [
"fastapi[standard]==0.115.14",
"pyautogui==0.9.54",
"pydantic==2.11.7",
"seleniumbase==4.40.0",
"fastapi[standard]==0.115.*",
"pyautogui==0.9.*",
"pydantic==2.11.*",
"seleniumbase==4.*",
"uvicorn==0.35.0",
]
urls = { repository = "https://github.com/ThePhaseless/Byparr" }
+2 -1
View File
@@ -30,7 +30,7 @@ VERSION = get_version_from_env() or "unknown"
USE_XVFB = os.getenv("USE_XVFB") in ["true", "1"] if os.getenv("USE_XVFB") else None
USE_HEADLESS = (
os.getenv("USE_HEADLESS") in ["true", "1"] if os.getenv("USE_HEADLESS") else None
os.getenv("USE_HEADLESS") in ["true", "1"] if os.getenv("USE_HEADLESS") else False
)
PROXY = os.getenv("PROXY")
@@ -38,6 +38,7 @@ PROXY = os.getenv("PROXY")
CHALLENGE_TITLES = [
# Cloudflare
"Just a moment...",
"Verifying you are human",
# DDoS-GUARD
"DDoS-Guard",
]
+13 -6
View File
@@ -5,7 +5,7 @@ from fastapi import Header, HTTPException
from httpx import codes
from sbase import SB, BaseCase
from src.consts import LOG_LEVEL, PROXY, USE_HEADLESS
from src.consts import LOG_LEVEL, PROXY, USE_HEADLESS, USE_XVFB
logger = logging.getLogger("uvicorn.error")
logger.setLevel(LOG_LEVEL)
@@ -27,12 +27,19 @@ def get_sb(
detail="SOCKS5 proxy with authentication is not supported. Check README for more info.",
)
kwargs = {
"uc": True,
"headless": USE_HEADLESS,
"xvfb": USE_XVFB,
"locale_code": "en",
"ad_block": True,
"proxy": proxy,
}
logger.info("Creating SeleniumBase instance with parameters: %s", kwargs)
with SB(
uc=True,
headless=USE_HEADLESS,
locale_code="en",
ad_block=True,
proxy=proxy,
**kwargs,
) as sb:
yield sb
+3 -2
View File
@@ -11,11 +11,12 @@ client = TestClient(app)
test_websites = [
"https://ext.to/",
"https://www.ygg.re/",
# "https://www.ygg.re/",
"https://extratorrent.st/",
"https://idope.se/",
"https://speed.cd/login",
'https://www.yggtorrent.top/engine/search?do=search&order=desc&sort=publish_date&name="UNESCAPED"+"DOUBLEQUOTES"&category=2145'
'https://www.yggtorrent.top/engine/search?do=search&order=desc&sort=publish_date&name="UNESCAPED"+"DOUBLEQUOTES"&category=2145',
"https://freedium.cfd/https://codingplainenglish.medium.com/docker-is-dead-and-its-about-time-b457d14b0a72"
]
Generated
+4 -4
View File
@@ -87,10 +87,10 @@ test = [
[package.metadata]
requires-dist = [
{ name = "fastapi", extras = ["standard"], specifier = "==0.115.14" },
{ name = "pyautogui", specifier = "==0.9.54" },
{ name = "pydantic", specifier = "==2.11.7" },
{ name = "seleniumbase", specifier = "==4.40.0" },
{ name = "fastapi", extras = ["standard"], specifier = "==0.115.*" },
{ name = "pyautogui", specifier = "==0.9.*" },
{ name = "pydantic", specifier = "==2.11.*" },
{ name = "seleniumbase", specifier = "==4.*" },
{ name = "uvicorn", specifier = "==0.35.0" },
]