This script allows you to download all the videos from a YouTube playlist and convert them to MP3 format.
- Python 3.x
- pytube
You can install the required dependencies using pip:
pip install pytube
- Run the script by executing the following command in your terminal:
python audio.py [-p PLAYLIST_INPUT]
- Optional Arguments:
-p, --playlist PLAYLIST_INPUT
: URL or ID of the YouTube playlist you want to download.
-
You can provide either the full URL of the playlist or just the playlist ID. For example:
python audio.py -p https://www.youtube.com/playlist?list=example_hash_ID
or
python audio.py -p example_hash_ID
-
If you don't provide the
-p
flag, the script will prompt you to enter the URL or ID of the YouTube playlist.
The script provides colored output to distinguish between different types of messages:
- [INFO]: Informational messages displayed in green.
- [WARNING]: Warning messages displayed in yellow.
- [ERROR]: Error messages displayed in red.
The script includes error handling to deal with various potential issues during the download and conversion process. Specific error messages are provided to help diagnose any problems that may occur.