Download YouTube Videos with youtube-dl

By  on  

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!

Recent Features

  • By
    Chris Coyier’s Favorite CodePen Demos

    David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...

  • By
    Write Better JavaScript with Promises

    You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...

Incredible Demos

  • By
    Telephone Link Protocol

    We've always been able to create links with protocols other than the usual HTTP, like mailto, skype, irc ,and more;  they're an excellent convenience to visitors.  With mobile phone browsers having become infinitely more usable, we can now extend that convenience to phone numbers: The tel...

  • By
    Create a CSS Flipping Animation

    CSS animations are a lot of fun; the beauty of them is that through many simple properties, you can create anything from an elegant fade in to a WTF-Pixar-would-be-proud effect. One CSS effect somewhere in between is the CSS flip effect, whereby there's...

Discussion

  1. youtube-dl is the best tool to download audio and video from YouTube. Ubuntu users can install youtube-dl with:

    sudo apt-get install youtube-dl
  2. is there a way to choose which quality you’ll be downloading?

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!