Studio711

YouTube Downloader

youtube-logo-drawnI watch a lot of YouTube videos. It has almost completely replaced anything that comes from traditional television in my viewing habits. The YouTube interface isn’t terrible, but I really like the idea of a DVR style interface where new shows automatically appear and then I can delete them when they are done. I want to be able to stream them to whatever device I’m on and remember my playback position in case I stop mid way. In true geek fashion, I have a technical solution (which I’ve partly described before.)

One of my computers runs a custom program that checks all of my YouTube subscriptions for new videos and then downloads them to my local computer. From there I can stream them to any of my devices via Plex. I thought about trying to package up that custom program because it would be useful for people like my parents who get free bandwidth between 12 and 5am but not during the day. This would allow them to schedule YouTube videos to be downloaded. But unfortunately my homegrown solution has gotten pretty complex over the years and it’s not super simple to package it up for re-use. Bad design I guess.

There are various programs and websites that will help you download local copies of YouTube videos, but the key here is getting something that can be scheduled to specifically solve my parents internet constraints. (Basically this is just an email to my Dad that I thought other people might find useful too.)

The good news is that the core of my solution isn’t too difficult to reuse. It’s a program called youtube-dl. It was originally just a python script but it looks like they have packaged it all up into a Windows executable now. You can get all the info along with their source code and the compiled executables on their GitHub site. (Look for the part that says “Windows users can download an .exe file…”)

Once you have that executable, you need to figure out what command line parameters to pass to it. I’m still using the straight Python version, but I’m guessing your command line would look something like this:

youtube-dl.exe http://www.youtube.com/watch?v=KDL2LcKnISU -f 22 -o “C:\kayaking.mp4”

Once you get that figured out, then you could schedule it via the Window Task Scheduler. That would be fine for one time video downloads. If you want to do this more often, then you’ll need to build up some automation around it to make it easier to use. I hooked into the YouTube APIs to get videos from my subscriptions and compare them with a list of videos that I’ve already downloaded, etc. I can provide more info if you want to go that far.

This all sounds crazy but it works really well. My setup has downloaded over 4000 YouTube videos over the years and most of the time I just plop down in front of the TV and watch whatever new videos have been placed there for me. I don’t have to think about the magic happening behind the scenes.

One thought on “YouTube Downloader