Skip to main content

yt-dlp-ejs

External JavaScript solver library for yt-dlp supporting multiple runtimes including Deno, Bun, and Node.js

What is yt-dlp-ejs?

yt-dlp-ejs is a specialized library that provides external JavaScript execution capabilities for yt-dlp, the popular video downloader. It solves YouTube’s signature and n-parameter challenges by preprocessing and executing JavaScript code in a sandboxed environment. The library is designed to work seamlessly across multiple JavaScript runtimes, making it flexible and reliable for different deployment scenarios.

Key Features

Multi-Runtime Support

Works with Deno, Bun, and Node.js, giving you flexibility in your runtime choice

YouTube Solver

Solves signature and n-parameter challenges for YouTube video extraction

AST Manipulation

Uses meriyah and astring for JavaScript AST parsing and code generation

Bundled Variants

Provides both core and lib solver bundles for different use cases

How It Works

yt-dlp-ejs preprocesses YouTube player JavaScript code to extract signature and n-parameter solving functions. These functions are then made available through a clean Python API that yt-dlp can use to decode video URLs. The library uses:
  • meriyah for parsing JavaScript into an Abstract Syntax Tree (AST)
  • astring for generating JavaScript code from the AST
  • rollup for bundling the solver code with dependencies

Use Cases

yt-dlp Integration

Primarily used as a dependency for yt-dlp to handle YouTube’s JavaScript challenges

Custom Video Extractors

Can be integrated into custom video extraction tools that need to solve YouTube challenges

Research & Development

Useful for studying YouTube’s protection mechanisms and developing new solving strategies

Next Steps

Installation

Install yt-dlp-ejs in your environment

Quickstart

Get started with basic usage examples

Architecture

Learn how the solver works internally

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love