When preparing for the 8 hour flights to and from London, I knew I couldn’t just code the whole time — I needed some decent entertainment. One source of free, excellent entertainment is YouTube, but I had no desire to pay for internet on the flight. With all of this in mind, I installed youtube-dl — a utility for downloading YouTube videos to your local drive.
To install youtube-dl, run the following from command line:
brew install youtube-dl
With youtube-dl available, simply run the utility with a URL:
# Download a video! youtube-dl https://www.youtube.com/watch?v=bS5P_LAqiVg # Download a video as audio youtube-dl -x https://www.youtube.com/watch?v=--HaFAtC17U
Executing that will download the given YouTube video to your machine. youtube-dl has more capabilities than just downloading videos such as: thumbnail retrieval, conversion to mp3 or other formats (assuming you have ffmpeg available), logging in, getting subtitles, and more.
Grab youtube-dl if you’re looking for music or video from YouTube — it’s the best application available to do the job!