explaingit

fent/node-ytdl-core

4,735JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A Node.js library for downloading YouTube videos programmatically, give it a URL and get back a readable stream you can save to a file or pipe to any destination.

Mindmap

mindmap
  root((node-ytdl-core))
    What it does
      Download YouTube videos
      Stream to file or player
      Fetch video metadata
    Download options
      Highest quality
      Audio only
      Video only
      Specific format
    Metadata
      Title and description
      Available formats
      Duration
    Status
      Maintenance paused 2023
      Community fork available
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Download YouTube videos to a local file from a Node.js script without any command-line tools

USE CASE 2

Extract audio-only streams from YouTube videos to process or save separately

USE CASE 3

Fetch a YouTube video's metadata like title and available formats without downloading the video

USE CASE 4

Build a server that streams YouTube content directly to users without storing it locally

Tech stack

JavaScriptNode.js

Getting it running

Difficulty · easy Time to first run · 5min

Active development paused July 2023, use the distube/ytdl-core community fork for ongoing updates and bug fixes.

License not specified in the explanation.

In plain English

node-ytdl-core is a Node.js library that downloads YouTube videos from within a JavaScript program. You give it a YouTube URL and it returns a data stream your code can pipe to a file, a media player, or any other destination. It is written in plain JavaScript with no compiled dependencies, and it follows the standard Node.js streaming interface. The library gives you control over what gets downloaded. You can choose quality (highest, lowest, a specific resolution), filter by format (video with audio, video only, audio only), or pick a specific format by its internal YouTube identifier. For cases where you want the audio and video as separate files to merge later, the library also supports downloading each stream independently. Beyond downloading, it can fetch metadata about a video without downloading any of it: title, description, available formats, duration, and similar information. It handles live streams as well as regular videos, though the README notes that seeking to a specific time position within non-live videos is not fully reliable. The README includes a prominent notice that active development was paused in July 2023. The original maintainers are no longer merging pull requests, and the project now relies on community support. For a version that receives ongoing updates, the README points to a community fork called distube/ytdl-core. Installation is via npm (npm install ytdl-core). It runs in any Node.js environment that supports streams, including scripts, servers, and CLI tools. There is no built-in command-line interface, it is purely a library meant to be called from your own JavaScript code.

Copy-paste prompts

Prompt 1
Write a Node.js script using ytdl-core that downloads only the audio stream from a YouTube URL and saves it to disk
Prompt 2
Use node-ytdl-core to fetch the highest quality video from a YouTube URL and pipe it to a local .mp4 file
Prompt 3
Help me list all available formats for a YouTube URL using ytdl-core and pick the one closest to 720p
Prompt 4
Write a Node.js Express route that accepts a YouTube URL as a query param and streams the video directly to the browser using ytdl-core
Prompt 5
Show me how to use node-ytdl-core to download audio and video as separate streams and combine them with ffmpeg
Open on GitHub → Explain another repo

← fent on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.