From a71a193879be17273cce61553d87abfd3cf393a6 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 1 Jun 2026 04:22:56 -0700 Subject: [PATCH] Bundled yt-dlp: install nightly (--pre) to fix broken impersonation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Symptom: with the bundled yt-dlp, every --impersonate target showed "(unavailable)" and impersonation silently did nothing. Root cause: it's a yt-dlp ⇄ curl_cffi version-gate mismatch, not a curl_cffi problem. curl_cffi 0.15.0 was installed and works on its own (a direct impersonate request returns 200), but stable yt-dlp 2026.3.17 caps support at curl_cffi <0.15: ImportError: Only curl_cffi versions 0.5.10 and 0.10.x through 0.14.x are supported …so yt-dlp refuses to load the impersonate backend and disables every target. yt-dlp master already raised the gate to <0.16, but that's only in nightly, not stable. Fix: install the nightly yt-dlp via `pip install --pre`. Nightly is yt-dlp's recommended track for keeping up with YouTube's anti-bot changes anyway (newly relevant now that we ship POT support), and it accepts current curl_cffi so we don't have to pin a fragile version. Verified on the bundled venv: nightly 2026.05.25 + curl_cffi 0.15.1b1 lists all impersonate targets, and `--impersonate chrome` resolves a real video end-to-end. The install script's existing "grep chrome in --list-impersonate-targets" verification now passes. Co-Authored-By: Claude Opus 4.7 --- src/ytdlp_bin.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ytdlp_bin.rs b/src/ytdlp_bin.rs index 099caa9..98b3770 100644 --- a/src/ytdlp_bin.rs +++ b/src/ytdlp_bin.rs @@ -121,6 +121,14 @@ fn deno_asset() -> &'static str { /// a Python virtualenv with `curl_cffi` (for `--impersonate` support) and /// the rest of `yt-dlp[default]`, plus a sibling `deno` for JS deciphering. /// +/// We install the **nightly** yt-dlp (`--pre`), not stable. YouTube's +/// anti-bot measures shift faster than yt-dlp's ~monthly stable cadence, +/// and stable lags on dependency support too: e.g. stable 2026.3.17 caps +/// `curl_cffi` at `<0.15` and silently disables *all* impersonate targets +/// when a newer curl_cffi is present, whereas nightly already accepts it. +/// Nightly is yt-dlp's own recommended track for users who need to keep +/// up with extractor + impersonation changes. +/// /// Runs through `bash -c` on Unix and PowerShell on Windows. pub fn install_command() -> Command { let root = bundled_root(); @@ -144,9 +152,9 @@ pub fn install_command() -> Command { Write-Host '==> creating Python venv'; \ & $py.Source -m venv '{venv}'; \ }}; \ - Write-Host '==> installing yt-dlp + curl_cffi'; \ + Write-Host '==> installing nightly yt-dlp + curl_cffi'; \ & '{venv}\\Scripts\\python.exe' -m pip install --upgrade pip; \ - & '{venv}\\Scripts\\python.exe' -m pip install --upgrade 'yt-dlp[default]' curl_cffi; \ + & '{venv}\\Scripts\\python.exe' -m pip install --upgrade --pre 'yt-dlp[default]' curl_cffi; \ Write-Host '==> downloading deno'; \ Invoke-WebRequest -Uri '{durl}' -OutFile '{bin}\\deno.zip'; \ Write-Host '==> extracting deno'; \ @@ -210,8 +218,11 @@ fi echo '==> upgrading pip in venv' '{venv}/bin/python' -m pip install --upgrade --quiet pip -echo '==> installing yt-dlp[default] + curl_cffi (this fetches a few packages)' -'{venv}/bin/python' -m pip install --upgrade --quiet --progress-bar off 'yt-dlp[default]' curl_cffi +# --pre installs the nightly yt-dlp. Stable lags on extractor + dependency +# support (e.g. it caps curl_cffi at <0.15 and disables impersonation when +# a newer one is installed); nightly keeps pace with YouTube's changes. +echo '==> installing nightly yt-dlp[default] + curl_cffi (this fetches a few packages)' +'{venv}/bin/python' -m pip install --upgrade --pre --quiet --progress-bar off 'yt-dlp[default]' curl_cffi # ── deno ──────────────────────────────────────────────────────────────────── echo '==> downloading deno'