The YouTube Playlist Downloader is a Python script that retrieves and downloads a specified number of videos from a given YouTube playlist. It uses Selenium to extract video links from the playlist and yt-dlp
to handle the video downloads. This tool is useful for downloading a batch of videos from YouTube playlists for offline viewing or archival purposes.
yt-dlp
to download videos in the best available format.yt-dlp
ffmpeg
(Optional): Required if you choose to download videos in a resolution higher than 360p.To install all the required modules, use the install.txt
file provided:
Install the required modules using the install.txt
file:
pip install -r install.txt
Install ffmpeg
(only if downloading videos in higher resolutions):
ffmpeg
executable from the official website and add it to your system PATH.ffmpeg
using Homebrew:
brew install ffmpeg
ffmpeg
using your package manager:
sudo apt-get install ffmpeg # For Debian-based distributions
sudo yum install ffmpeg # For Red Hat-based distributions
Make sure you also have a compatible version of Chrome installed, as the script uses Chrome WebDriver.
To execute the script, follow these steps:
Clone or Download the Repository: Ensure you have the script file (app.py
) in your working directory.
Navigate to the Script Directory: Open your terminal and change to the directory containing the script.
Run the Script: Execute the script by running:
python app.py
Follow the Prompts: Enter a PUBLIC or UNLISTED YouTube playlist URL and the maximum number of videos you want to retrieve when prompted.
View Download Progress: The script will display the progress of the video retrieval and downloading process in the terminal.
Enter a Public or Unlisted YouTube playlist URL: https://www.youtube.com/playlist?list=PL0vfts4VzfNjdPuyk9SJDIvpsOjNgU1bs
Enter the maximum number of videos to retrieve: 2
Choose Resolution:
1) 360p
2) up to 1080p
3) .mp3
Choose Number: 2
With this example, the script will retrieve up to 2 video links from the playlist and download them into a downloads
directory within the current script directory.
ffmpeg
: If you select a video resolution higher than 360p, make sure ffmpeg
is installed. Without ffmpeg
, the script may not be able to process higher-resolution downloads.