There’s a plethora of content on YouTube, especially music. I’m sure we’ve all at one point or another Googled “YouTube to MP3”, only to sift through about 5 different sites. The top one sometimes works, the second one requires registration, and the third one maybe works, but, awfully slowly.
This is a significant pain point in my life. Last year, I discovered youtube-dl. This is a program that allows you to paste a YouTube URL into your command line and download a YouTube video for offline access. This worked great up until some time last year when YouTube updated their system and (probably purposefully) nerfed youtube-dl. Now, videos that previously would download in a moment took minutes to finish at max speeds of 100kb/s. On top of this, the youtube-dl team has been slow to issue new releases to solve the problem.
This pushed me to look for another program that could fill the hole that a broken youtube-dl had left. That’s when I discovered yt-dlp. It uses very similar command line options and behaves as a drop-in for youtube-dl.
As a major plus, it doesn’t just support downloading from YouTube. There’s a massive list of supported websites so long that I don’t think anymore before I plug a link into yt-dlp, simply trusting that it will handle the link just fine.
I’m creating this post as both a way to advertise my support of a great piece of OSS, and provide myself a nice easy cheatsheet of commands. I’m constantly looking up the shortcut for handling MP3 conversion, so I might as well have my own instruction-set.
Installation
Installation couldn’t be easier. On a Windows machine, head to the GitHub page for yt-dlp and go to Releases. From here, find your relevant binary file and download.
On my Windows machine, I’ll want access to this exe file from anywhere. I put it in a useful directory and point my PATH variables to the new directory.
Great. Now I can run “yt-dlp” from my Terminal and it works from any directory.
Normally, when using this to download music, I’ll be in my music directory running these commands.
So, how simple is it to grab some mp3’s?
It couldn’t be easier. With the executable file in my PATH, the command will look something like this:
yt-dlp.exe "https://www.youtube.com/watch?v=Ej8rdi-cwdw&list=PL54431cQSETCL_aiFfRzZXab03f3Y8jk7" --audio-format mp3 -x
That’s a URL pointed to a playlist of The Beatle’s White Album. Running this command will actually download the entire YouTube playlist and convert the files to MP3. All in one go!
I’m sure this doesn’t match the audio quality of an uncompressed FLAC, but nobody has ever accused me of being an audiophile.