How to download YoutTube videos via command line and convert to mp3 on OSX

If you ever had to download a video from YouTube and convert it to a mp3 file you know that there are a lot of shady looking sites offering that exact service.

But there is a more convenient way, especially, if you are a Mac and OSX user.

A guy called rg3 on GitHub created a repository which provides a neat little command line tool to download videos from several portals with several different options. Description from the repo:

youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on Mac OS X. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.

https://github.com/rg3/youtube-dl

There are several ways to install the tool. You can choose from curl, wget, pip, mac ports or brew. I chose brew:

brew install youtube-dl

In addition it is necessary to install ffmpeg, an audio converter,which will automatically convert the downloaded videos to mp3. This is also possible via brew:

brew install ffmpeg

Now you are good to go.
There are countless options available for the downloader. Check the GitHub README for a full list.

Now simply access to your desired destination folder via terminal and enter the following command:

youtube-dl -x –audio-format mp3 https://www.youtube.com/watch\?v\=abc1DEF2ghi3JKL4

This will first download the video and then convert the file to mp3.

Web Development/Programming Music

Every developer has their own recipe to concentrate. Some say music is distracting, others can’t live without it.

For me the later is definitely the case.
From time to time I just love to go into a tunnel and shut everything out with some good tunes.

Not any kind of music though. Lyrics are definitely distracting and pop music would go on my nerves within a minute.

For me Deep House or Electronic Ambient works the best.
Music that is neither annoying, nor irritating.
YouTube is my goto-source to find new tracks from that genre.
It is simply amazing how much variety is available.
From single tracks to full albums to custom mixes.

Here are some mixes that really help me:

Poptartpete_-_Palmas
Poptartpete – Palmas
PoptartPete - Morning Blunt
PoptartPete – Morning Blunt
Neat Beats - Sleep Cycles
Neat Beats – Sleep Cycles
Shlohmo - Bad Vibes
Shlohmo – Bad Vibes