If you for one reason or another want to download YouTube videos as MP3 tracks, you can do that with a one-liner from the GNU/Linux command line. I do it because I like to save songs on my hard drive in case they get taken down, get censored in my country, or for listening to if I don't have an Internet connection. I also like to have my own music collection that I have full control over.
First you have to install youtube-dl and FFmpeg. On Ubuntu systems (and probably on others too, with Python pre-installed):
sudo pip3 install youtube-dl
If you already have youtube-dl installed on Ubuntu the regular apt-way, I recommend installing it with pip3. That way you have a new version of it installed and it doesn't give you errors when trying to download videos and audio. To do that, run the following:
sudo apt purge youtube-dl sudo pip3 install youtube-dl
To update youtube-dl, just run the following command:
pip3 install -U youtube-dl
Download a Single Song
Download the song you want with the following command:
youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg <song URL here>
If you want the best possible audio quality, but not necessarily in the MP3 format, then run:
youtube-dl --extract-audio --audio-format best --prefer-ffmpeg <song URL here>
Download a Playlist of Songs
Just use the same commands as above, but with the playlist URL in the end instead.