Download MP3 Audio only from YouTube

For the longest time, there was youtube-dl, a tool used to download video content from YouTube. This is great if you need to get your old videos back, or something else.

Also before I get too carried away with the downloading, I am aware of YT audio types and limits. I’d suggest you read this document as well about the various formats that YT has to offer and why MP3 is actually not a supported format.

Now where we? Ah yes. Real-world use-cases for a tool like youtube-dl…

Let’s say there’s a news service or a recurring show that you need to download from a channel, and doing it manually just takes too long? What if you miss it, or it’s late, or you just can’t be there to download it if it’s required ‘now’?

Well, this is where youtube-dl comes in… so I thought. In my quest for using this tool, I found yt-dlp, which is a fork, but has the downloads running at more than twice the speed, so I would recommending using the newer version.

As well as downloading the yt-dlp file, you’ll also need the FFMPEG file too.

It took me a while to figure out how to get the settings correct, but here’s an example which will search for a keyword, and only look at the most recent 3 entries in the channel, and download the correct file and convert it to whatever filename you need.

yt-dlp --playlist-end 3 --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "news.mp3" "https://www.youtube.com/channel/UC16niRr50-MSBwiO3YDb3RA/videos" --match-title "your_keyword"

To do this yourself, you will need the channel ID of the Youtube Account that you are using. For example for the BBC, they use the following user name path: https://www.youtube.com/user/BBCNews

But, it doesn’t tell you the channel id, so you’ll need to use a 3rd party site to help you, such as this one:

https://commentpicker.com/youtube-channel-id.php

Enter the user URL and you should be good.

As another example only, and using the BBC, let’s try the last 50 videos that contain the word ‘Trump’ in the title – just because.

yt-dlp --playlist-end 50 --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "trump.mp3" "https://www.youtube.com/channel/UC16niRr50-MSBwiO3YDb3RA/videos" --match-title "trump"

So, the results? Have a look…

And, there’s our trump.mp3 file in Winamp.

So, really the question that remains, is being able to automate this.

I’ll leave it to you, but I like using the System Scheduler tool by Splinterware.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: