Bundled yt-dlp: install nightly (--pre) to fix broken impersonation
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 <noreply@anthropic.com>
This commit is contained in:
parent
490998c8fd
commit
a71a193879
1 changed files with 15 additions and 4 deletions
|
|
@ -121,6 +121,14 @@ fn deno_asset() -> &'static str {
|
||||||
/// a Python virtualenv with `curl_cffi` (for `--impersonate` support) and
|
/// a Python virtualenv with `curl_cffi` (for `--impersonate` support) and
|
||||||
/// the rest of `yt-dlp[default]`, plus a sibling `deno` for JS deciphering.
|
/// 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.
|
/// Runs through `bash -c` on Unix and PowerShell on Windows.
|
||||||
pub fn install_command() -> Command {
|
pub fn install_command() -> Command {
|
||||||
let root = bundled_root();
|
let root = bundled_root();
|
||||||
|
|
@ -144,9 +152,9 @@ pub fn install_command() -> Command {
|
||||||
Write-Host '==> creating Python venv'; \
|
Write-Host '==> creating Python venv'; \
|
||||||
& $py.Source -m venv '{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 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'; \
|
Write-Host '==> downloading deno'; \
|
||||||
Invoke-WebRequest -Uri '{durl}' -OutFile '{bin}\\deno.zip'; \
|
Invoke-WebRequest -Uri '{durl}' -OutFile '{bin}\\deno.zip'; \
|
||||||
Write-Host '==> extracting deno'; \
|
Write-Host '==> extracting deno'; \
|
||||||
|
|
@ -210,8 +218,11 @@ fi
|
||||||
echo '==> upgrading pip in venv'
|
echo '==> upgrading pip in venv'
|
||||||
'{venv}/bin/python' -m pip install --upgrade --quiet pip
|
'{venv}/bin/python' -m pip install --upgrade --quiet pip
|
||||||
|
|
||||||
echo '==> installing yt-dlp[default] + curl_cffi (this fetches a few packages)'
|
# --pre installs the nightly yt-dlp. Stable lags on extractor + dependency
|
||||||
'{venv}/bin/python' -m pip install --upgrade --quiet --progress-bar off 'yt-dlp[default]' curl_cffi
|
# 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 ────────────────────────────────────────────────────────────────────
|
# ── deno ────────────────────────────────────────────────────────────────────
|
||||||
echo '==> downloading deno'
|
echo '==> downloading deno'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue