Skip to content

fix(dl-video): pass JS runtime + alt YouTube player_clients to yt-dlp#5

Open
jjaavvin-web wants to merge 1 commit into
sonpiaz:mainfrom
jjaavvin-web:fix/dl-video-yt-dlp-js-runtime-and-client
Open

fix(dl-video): pass JS runtime + alt YouTube player_clients to yt-dlp#5
jjaavvin-web wants to merge 1 commit into
sonpiaz:mainfrom
jjaavvin-web:fix/dl-video-yt-dlp-js-runtime-and-client

Conversation

@jjaavvin-web
Copy link
Copy Markdown

Summary

dl-video currently fails on YouTube with ERROR: [youtube] <id>: Requested format is not available on systems where:

  • Deno isn't installed (yt-dlp's only auto-enabled JS runtime), and/or
  • The user is signed into Google (default tv_downgraded / web_creator clients now demand a Data Sync ID).

yt-dlp can only emit storyboard images in that state, so the download silently degrades. Symptoms reported elsewhere: yt-dlp#11904, #11932.

This PR adds two flags to the existing run_dl invocation:

  • --js-runtimes node:$(command -v node) — only when node is on PATH. Lets yt-dlp solve YouTube's obfuscated n parameter without requiring a Deno install.
  • --extractor-args "youtube:player_client=web_safari,mweb,android_vr,ios" — forces clients that don't need a Data Sync ID.

Both are scoped — node check prevents regressions on Deno-equipped systems, and the extractor-args namespace (youtube:) leaves TikTok/X/Vimeo/LinkedIn extraction unchanged.

Why these specific clients

web_safari, mweb, android_vr, and ios are the player clients currently confirmed by the yt-dlp project to bypass the Data Sync ID requirement while still exposing the full mp4/webm format ladder (135–401, including 480p–4K progressive variants). I chose four rather than one to give yt-dlp fallback room as YouTube rotates restrictions.

Test plan

  • Run watch <youtube-url> on a video that previously failed with "Requested format is not available" — confirm it now downloads.
  • Run watch <tiktok-url> and watch <vimeo-url> — confirm non-YouTube hosts still work (extractor-args is youtube-only namespace).
  • On a system without node installed (Deno-only), confirm no warnings appear about the missing runtime flag.

Notes

Tested on WSL2 Ubuntu, yt-dlp 2026.03.17, Node 22.x at ~/.local/bin/node. The same fix should apply on macOS — command -v node resolves Homebrew/nvm installs equally.

Happy to adjust the player_client list if you'd prefer a smaller set, or to gate the extractor-args behind a [[ "$URL" == *youtube* ]] check if you want it strictly opt-in for YT URLs.

🤖 Generated with Claude Code

yt-dlp's default extraction path for YouTube currently fails with
"Requested format is not available" on systems that don't have Deno
installed and/or are signed into Google, because:

1. YouTube's URL "n parameter" requires a JS runtime to deobfuscate.
   yt-dlp only auto-enables Deno; Node (much more commonly installed)
   must be passed explicitly with --js-runtimes.

2. The default tv_downgraded / web_creator clients now demand a
   "Data Sync ID" for signed-in accounts that yt-dlp can't synthesize,
   so format extraction returns only storyboard images. Forcing the
   web_safari / mweb / android_vr / ios clients sidesteps the check.

Both flags are passed conditionally / scoped:
- --js-runtimes is only added if `node` is on PATH (no regression for
  Deno-equipped systems).
- --extractor-args is namespaced to `youtube:`, so other extractors
  (TikTok, X, Vimeo, …) are unaffected.

Verified locally on a 21-minute YouTube video that previously hit
"Only images are available for download" — now downloads cleanly.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant