YT-playlist-downloader is a command-line tool that downloads every video in a YouTube playlist as an MP3-file and automatically adds id3 tags to them. Those tags allow MP3 players to display information about a song such as the author or title. It also detects new videos in the playlist and downloads only those.
This project uses youtube-dl by Ricardo Garcia to download YouTube videos.
Either download the files as a zip and unpack them or clone the repository by running:
git clone https://github.com/italoalanw3/yt-playlist-downloader.git
Install Python
Note: Please use Python 3.
Run this command that installs required Python modules with pip (pip should come with Python):
pip install colorama requests lxml mutagen beautifulsoup4 youtube_dl
You are now ready to use yt-playlist-downloader.
To download videos in a playlist, run this command:
python ytdl.py "[url]" "[directory]"
Please include the quotation marks.
URL to a video in the playlist (not to the playlist itself)
This means that the url should include /watch?v= and &list= like this:
https://www.youtube.com/watch?v=XCV34VJX&index=1&list=lskfjgPOIJSd63ksfgd345f43hjkl
and not /playlist?list= like this:
https://www.youtube.com/playlist?list=lskfjgPOIJSd63ksfgd345f43hjkl
Also keep in mind that it will download only the first 200 videos in a playlist. If you have more than 200 videos, please create multiple playlists. Downloading only new videos will still work.
Local path to a directory where you want to download all videos to / where you already keep your downloaded files.
python ytdl.py "https://www.youtube.com/watch?v=XCV34VJX&index=1&list=lskfjgPOIJSd63ksfgd345f43hjkl" "/home/nicolas/music/"
python ytdl.py "https://www.youtube.com/watch?v=XCV34VJX&index=1&list=lskfjgPOIJSd63ksfgd345f43hjkl" "D:\Music\"
yt-playlist-downloader automatically sets the following MP3 tags (ID3):
Usually the first part of the YT-title
Usually the second part of the YT-title
The YouTube-URL of the video which is used for comparing local MP3-files to the videos in a playlist.
For auto tag-setting to work flawlessly, the YT-title of the video must follow the following pattern:
Artist - Title (additional information)
If the YT-title contains exactly one dash ('-'), the left part of it will be used as the artist tag and the right part will be used as the title tag. Otherwise, the user will be prompted to enter the artist and song title after the whole download process finished.
Square brackets ('[ ]') and everything inside them will be removed from the title, as well as these characters: ' \ / " . _ :
The command to edit the tags is:
python ytdl.py edit "[MP3]"
Please include the quotation marks.
Local path to the MP3 file that you want to edit.
The program will now output the tags artist, title and URL with their current values. To exit editing mode, enter
exit
To edit tags, enter a command like this:
[tag]=[value]
Tag name, e.g. artist
Value for the tag, e.g. Adele
python ytdl.py edit "D:\Music\Adele - Rolling In The Deep.mp3"
Output:
Artist=Adel
Title=Rolling In The
URL=https://www.youtube.com/watch?v=rYEDA3JcQqw
You can now enter e.g.:
artist=Adele
title=Rolling In The Deep
exit
You have now changed the tags.