This repository provides a script for downloading YouTube playlists, channels, or individual videos as high-quality video files. The script utilizes yt-dlp
and ffmpeg
to download and merge video and audio files into a single, unified file.
- Download YouTube playlists, individual videos, or all videos from a channel.
- Download videos in high-quality (up to 1080p).
- Automatically merge video and audio using
ffmpeg
. - Show download progress in the terminal with an easy-to-read progress bar.
I created this script because I needed to download some educational courses from YouTube for offline viewing. Specifically, I wanted to download:
- A YouTube playlist containing AWS courses: AWS Course Playlist.
- Another English course by Mr. Ihab Ramzi, available on his channel: Ihab Ramzi's Channel.
This script allows you to provide a link to an individual video, a playlist, or even the entire videos page of a channel, such as Ihab Ramzi's Videos, and it can download all the videos efficiently.
- Node.js: Download and install Node.js from the official Node.js website.
- Python:
yt-dlp
requires Python. Install it from the official Python website and add it to your system PATH.
To verify the installations, open a terminal and run:
node -v
npm -v
python --version
Clone the repository to your local machine and navigate into the project directory:
git clone https://github.com/AmirHaytham/youtube_playlist_downloader.git
cd youtube_playlist_downloader
Install the required Node.js packages:
npm install progress
-
Download
yt-dlp
:- Visit the yt-dlp releases page and download the
yt-dlp.exe
file. - Save
yt-dlp.exe
in a directory, such asC:\yt-dlp\
.
- Visit the yt-dlp releases page and download the
-
Download
ffmpeg
:- Visit the ffmpeg download page, and download a Windows build (e.g., from gyan.dev).
- Extract the downloaded ZIP file and locate
ffmpeg.exe
in thebin
folder. - Move
ffmpeg.exe
to a directory, such asC:\ffmpeg\bin\
.
Update the script file (downloadPlaylist.js
) with the correct paths to yt-dlp
and ffmpeg
:
// Paths to yt-dlp and ffmpeg executables
const ytDlpPath = 'C:\\yt-dlp\\yt-dlp.exe'; // Update to the actual path where yt-dlp.exe is located
const ffmpegPath = 'C:\\ffmpeg\\bin\\ffmpeg.exe'; // Update to the actual path where ffmpeg.exe is located
-
Set the desired playlist, video, or channel URL in the
playlistUrl
variable within the script.Example URLs:
- Playlist URL:
https://www.youtube.com/watch?v=E3nLSHQtLes&list=PLOoZRfEtk6kWSM_l9xMjDh-_MJXl03-pf
- Channel videos page:
https://www.youtube.com/@IhabRamziyallaspeak/videos
- Playlist URL:
-
Run the script to start downloading videos:
node downloadPlaylist.js
This command will start the download process, showing progress for each video in the terminal.
- Add functionality to download video and audio from YouTube playlists.
- Integrate
yt-dlp
for high-quality video downloads. - Integrate
ffmpeg
to merge audio and video files. - Add a progress bar to show download status.
- Add functionality to download all videos from a channel.
- Create a setup script for easier installation.
- Add error handling for unsupported formats or unavailable videos.