YouTube Playlist Downloader

Command line tool used to download every video in a YouTube playlist as an MP3-file and automatically add ID3 tags to them.

These tags are used by MP3 players to display the author and title of a song. The program also checks if the user already downloaded a video in the playlist so that he/she doesn’t have to download the same video multiple times.

Note: This project uses youtube-dl by Ricardo Garcia to download YouTube videos.

Table of contents

Finding the idea

I had a huge YouTube playlist with every song I wanted to listen to. Eventually, I wanted to also listen to it on the go, so I had the following options:

Obviously, using Spotify would have been boring and I wouldn’t have ended up with a great project. Existing YouTube downloaders didn’t even have the features I implemented.

Building the program

The current version you can find on GitHub isn’t the first version. After some time using the first version, I realized what I could do better to improve the program a whole lot. To find all the video URLs in a playlist, I used Selenium for Python which started a complete instance of FireFox that I could control programmatically. I used that because I couldn’t get the HTML code of YouTube with an HTTP request. The reason was that I set the playlist to private but setting it to not listed allowed me to simply use an HTTP request. I then parse the HTML code of YouTube to find the video URLs.

Also, I wondered why after some time the author and title tags of the downloaded MP3s weren’t correct anymore until I found out that I used a data structure that is unordered. That’s of course corrected in the current version.

What is more, I now used Python modules to split my code into multiple files because it would have gotten too messy.

Main functionality

The user is able to specify the URL to a video in the target playlist and the directory where the user wants to save the files. The program then checks all files in the specified directory and proves if there are videos in the playlist that are not already downloaded. If yes, only the new videos will be downloaded. This comparison is done with the video URL that is saved in an ID3 tag in the MP3 file.

After downloading, the program will automatically set the ID3 tags. Author and title of the song are determined by taking the video title and splitting it at the dash (‘-‘), provided that there is exactly one. If not, the user will be prompted to manually enter author and title. The left side of the dash will be the author and the right the title.

You can also edit the tags of an MP3-file.

What I learned

I learned the basic usage of Selenium (even though not used anymore), what ID3 tags are and how to edit them and I enormously extended my overall Python skills.

My favorite thing about this project

is that I imagined it to be pretty complex but after breaking everything down into small problems, it was really manageable.


This again is a project that has taught me very much and that I brought to life because I needed something. Step out of your comfort zone to learn and improve yourself. If something seems impossible to do, break it down into small problems and work through it.