@distube/ytdl-core
@distube/ytdl-core
Section titled “@distube/ytdl-core”YouTube video info and downloads for Node.js. A DisTube fork of ytdl-core.
Documentation · Getting started · API reference
Features
Section titled “Features”- Video details, chapters, storyboards, related videos and every format
- Caption tracks as WebVTT, JSON or XML text
- Video and playlist search, playlists and channel uploads with every page, related videos and search suggestions
- Node
Readabledownloads with byte ranges or a start time, and one format read many times throughopen - Downloads that resume on their own when YouTube cuts a URL off
- Live streams over HLS or DASH
- SABR-only formats, which on some clients means everything above 360p
- Signatures solved locally, no remote service
- Age-restricted videos with a cookie, and a built-in PO token provider
- Proxies through any
fetch
Install
Section titled “Install”npm install @distube/ytdl-corebun add @distube/ytdl-coreRequires Node.js 22.22.2+ on 22.x, 24.15.0+ on 24.x, or 26+, or Bun.
import { createWriteStream } from "node:fs";import { Quality, Ytdl } from "@distube/ytdl-core";
const yt = new Ytdl();
const info = await yt.getInfo("https://www.youtube.com/watch?v=aqz-KE-bpKQ");console.log(info.videoDetails.title);
yt.download(info, { quality: Quality.HighestAudio, filter: { hasAudio: true, hasVideo: false } }).pipe( createWriteStream("audio.webm"),);
const [first] = await yt.search("blender open movie", { limit: 5 });const playlist = await yt.getPlaylist("https://www.youtube.com/playlist?list=PL2aBZuCeDwlRF14ds9UR1uVpLRjDQy7d5");console.log(first?.title, playlist.videos.length);Search, formats, live streams, clients, cookies, PO tokens, proxies and errors are covered in the documentation. Coming from 4.x? Read Migrating from v4.
Development
Section titled “Development”Run bun install, then bun run verify for the offline gates.
License
Section titled “License”MIT. Originally fent/node-ytdl-core and its contributors.
SABR streaming uses googlevideo, MIT, as a dependency.