A simple and powerful Node.js tool to download YouTube videos and playlists with ease.
Works both as a CLI tool and as a library. 🎥🎶
- Download single YouTube videos
- Download entire playlists in one command
- Support for both audio-only (mp3) and video (mp4) formats
- Fast & reliable (powered by
yt-dlp) - Usable both as a CLI and as a library
npm install -g ytsavenpm install ytsave
ytsave relies on the external tool yt-dlp to download media and (optionally) ffmpeg to merge separate video/audio streams. Install them on your system and ensure they're available on your PATH before running the CLI.
Windows
- Using winget:
winget install yt-dlp - Using pip (if Python is installed):
pip install yt-dlp - Using Scoop:
scoop install yt-dlp - Using Chocolatey:
choco install yt-dlp - Or download the
yt-dlp.exefrom the releases page and add it to your PATH: https://github.com/yt-dlp/yt-dlp/releases
macOS
- Using Homebrew:
brew install yt-dlp
Linux
- Using pip:
pip3 install --user yt-dlp
- Using your distro package manager (if available) or download the binary from the releases page.
ffmpeg (optional but recommended)
- ffmpeg is required if yt-dlp needs to merge separate video and audio streams (this happens when selecting the best video and best audio). Install ffmpeg via your platform package manager:
- Windows (scoop/choco) —
scoop install ffmpegorchoco install ffmpeg - macOS (Homebrew) —
brew install ffmpeg - Linux (apt/yum/pacman) —
sudo apt install ffmpegor equivalent
- Windows (scoop/choco) —
After installing, verify both commands are available:
yt-dlp --version
ffmpeg -version
ytsave https://www.youtube.com/watch?v=dQw4w9WgXcQytsave https://www.youtube.com/playlist?list=PL123456789ytsave https://www.youtube.com/watch?v=dQw4w9WgXcQ --format mp4 --output ./videos ytsave https://www.youtube.com/playlist?list=PL123456789 --format mp3 --output ./music--format <mp4|mp3>→ Output format (default:mp4)--output <path>→ Output directory (default: current folder)
import { downloadVideo, downloadPlaylist } from "ytsave";await downloadVideo("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
format: "mp4",
output: "./videos",
});await downloadPlaylist("https://www.youtube.com/playlist?list=PL123456789", {
format: "mp3",
output: "./music",
});
This project is for educational purposes only. Downloading videos or music from YouTube may violate YouTube’s Terms of Service. Use responsibly.