Download Youtube videos for Offline Viewing

26/11/2016

Everything requires you to be online nowadays, from time to time that can be pretty frustrating if you are traveling place where you know you won’t have internet. Youtube contains a lot of great content, but because they make money by showing advertisements (and a lot of them) the they have no builtin way that allows you to download the content for offline viewing.

Luckily there’s a nice community project, youtube-dl that allows you to download content from youtube, and a quite long list of other sources.

The tool is written in python and is a commandline too, the main problem is that it requires regular updating as youtube does many things to prevent people from downloading their videos. Personally I don’t do any python on my Windows machine, and it is quite rare that I need to download videos from youtube, but when I do I just need a quick and easy solution.

That is why it for me works perfectly to have the tool installed in a docker container. I found https://registry.hub.docker.com/r/backplane/youtube-dl this image receives regular updates and contains youtube-dl and ffmpeg (required to convert the videos).

To use the container all you have to do is run

docker run --rm -v c:/temp:/work backplane/youtube-dl [Youtube-Video-Id]

The [Youtube-Video-Id] should be replaced with the video id of the video you want to download, they look like: IC-bSbXZBcU note that they are case sensitive.

The video is downloaded to c:/temp which must have been shared with docker (if you use docker for windows, like me).