From de2f4bbd6f686b2432590459a5cbfbef7337ef6a Mon Sep 17 00:00:00 2001 From: Meisoftcoltd <38667978+Meisoftcoltd@users.noreply.github.com> Date: Mon, 20 Apr 2026 12:39:08 +0000 Subject: [PATCH] feat: integrate bgutil-ytdlp-pot-provider to bypass YouTube PO Tokens - Replaced contents of `requirements.txt` to strictly include core yt-dlp dependencies and the new anti-blocking tools (`bgutil-ytdlp-pot-provider` and `bgutil`). - Added `bgutil` to the auto-installation requirement list in `__init__.py`. - Updated the pip install command in `__init__.py` to include `bgutil-ytdlp-pot-provider`. - Combined the new `po_token=web+bgutil` extractor argument with the existing `youtube:player_client` definitions in `build_cmd` to bypass blocking issues. --- __init__.py | 7 ++++--- requirements.txt | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index ddef60a..2e05c38 100644 --- a/__init__.py +++ b/__init__.py @@ -21,6 +21,7 @@ def install_missing_requirements(): ("opencv-python", "cv2"), ("websockets", "websockets"), ("playwright", "playwright"), + ("bgutil", "bgutil"), ] missing = [] @@ -31,7 +32,7 @@ def install_missing_requirements(): if missing: print(f"📥 ComfyUI-Ytdpl: Instalando dependencias faltantes: {missing}") try: - subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", *missing, "yt-dlp-ejs"]) + subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", *missing, "yt-dlp-ejs", "bgutil-ytdlp-pot-provider"]) print("✅ Dependencias instaladas correctamente.") if "playwright" in missing: print("📥 Instalando navegadores de Playwright...") @@ -211,9 +212,9 @@ class YTDLPVideoDownloader: if cookie_path_to_use: cmd.extend(["--cookies", str(cookie_path_to_use)]) - cmd.extend(["--extractor-args", "youtube:player_client=tv_downgraded,web"]) + cmd.extend(["--extractor-args", "youtube:player_client=tv_downgraded,web;po_token=web+bgutil"]) else: - cmd.extend(["--extractor-args", "youtube:player_client=android,tv"]) + cmd.extend(["--extractor-args", "youtube:player_client=android,tv;po_token=web+bgutil"]) # === CAMBIO: USAR NOMBRES GENÉRICOS DE NAVEGADOR PARA CURL-CFFI === if browser_source != "Ninguno": diff --git a/requirements.txt b/requirements.txt index 15b3112..e7053e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,6 @@ yt-dlp-ejs # Motor para resolver el JS Challenge de YouTube curl-cffi # Necesario para "impersonation" (Bypass HTTP 403) websockets # Requerido por componentes internos de yt-dlp +# --- Sistema Anti-Bloqueos (PO Tokens) --- +bgutil-ytdlp-pot-provider # Plugin para evasión de bloqueos +bgutil # Motor base para resolver Botguard \ No newline at end of file