DEV Community

阿豪
阿豪

Posted on

ytdlp-jsc: A JS Challenge Solver Without Runtime Dependencies

ytdlp-jsc is a yt-dlp plugin that solves YouTube's JavaScript challenges without requiring external JS runtimes like Node.js or Deno.

GitHub: ahaoboy/ytdlp-jsc

Quick Start

pip install ytdlp-jsc --target ~/.yt-dlp/plugins/
yt-dlp -F "https://www.youtube.com/watch?v=BnnbP7pCIvQ"
Enter fullscreen mode Exit fullscreen mode
[youtube] BnnbP7pCIvQ: Downloading player c816c7d8-main
[youtube] [jsc:ytdlp-jsc] Solving JS challenges using ytdlp-jsc
[info] Available formats for BnnbP7pCIvQ:
Enter fullscreen mode Exit fullscreen mode

Why Not Just Use a JS Runtime?

Runtime vs Engine

Type Capabilities Security
Runtime (Node, Deno) Full system access: file I/O, network, shell Higher risk
Engine (QuickJS) JS execution only Sandboxed

ytdlp-jsc embeds a lightweight JS engine — no system access, no security concerns.

Startup Time Matters

deno a.js    → 400ms
qjs a.js     → 27ms
Enter fullscreen mode Exit fullscreen mode

Deno is safe but slow to start. For a single challenge solve:

Approach Breakdown Total
External runtime CLI start (200ms) + parse (50ms) + codegen (50ms) + run (50ms) ~350ms
ytdlp-jsc (SWC + QJS) Load .pyd (50ms) + parse (100ms) + codegen (100ms) + run (100ms) ~350ms

Despite using a slower engine, ytdlp-jsc matches runtime performance by eliminating CLI startup overhead.

Benchmarks

Tested on GitHub CI (~5MB binary):

ejs --runtime qjs     1.00x (baseline)
node                  1.35x slower
ytdlp-jsc             1.44x slower
ytdlp-jsc-cli         1.54x slower
bun                   1.56x slower
deno                  1.59x slower
Enter fullscreen mode Exit fullscreen mode

Top comments (0)