A simple Node.js CLI tool for downloading YouTube videos and audio using yt-dlp via the yt-dlp-exec npm package. No system installation of yt-dlp required!
- Download YouTube videos in MP4 format
- Download audio as MP3
- Specify quality (best, worst, or a specific resolution/bitrate)
- No need for Python or system-wide yt-dlp install
-
Clone or download this repository.
-
Install dependencies:
npm install
node yt_dld.js <YouTube_URL> --format=mp4node yt_dld.js <YouTube_URL> --format=mp3-
For video (e.g., 720p):
node yt_dld.js <YouTube_URL> --format=mp4 --quality=720
-
For audio (e.g., 128k):
node yt_dld.js <YouTube_URL> --format=mp3 --quality=128k
<YouTube_URL>: The URL of the YouTube video to download (required)--format=mp4|mp3: Output format (default: mp4)--quality=best|worst|<height>|<abr>: Quality (default: best)- For video: use a number for resolution (e.g., 720)
- For audio: use a bitrate (e.g., 128k)
- The downloaded file will be saved in the current directory, named after the video title.
node yt_dld.js https://youtu.be/dQw4w9WgXcQ --format=mp4
node yt_dld.js https://youtu.be/dQw4w9WgXcQ --format=mp3MIT