Sometimes you come across a video in YouTube and you want to save its audio. Originally I thought it would take some search for the actual URL of the flv source, then downloading it using
wget and finally conversion using
ffmpeg. But luckily for me, it turns out there is much simpler way to so so:
youtube-dl is small python script that does it all. It will download and extract the audio from a YouTube video without any hassle.
Installation is quick via
$ pip install --user youtube_dl
Note that there is an underscore there instead of an hyphen.
youtube-dl is also available in Ubuntu’s repository, however the version there is too old and didn’t work for me. The
--user flag tells
pip to install it for the current user (I just don’t like installing unnecessary things as root ). Now all you have to do is:
$ youtube-dl --extract-audio http://www.youtube.com/watch?v=XXXXXXXXXX
All that is left is to fix the metadata tags of the file with the correct values with your favorite player.