Parckwart’s Computer Stuff

⟵ Home page

Published: October 31, 2015
Last updated: March 12, 2016

Automatic Archiving of YouTube Channels

In order to keep YouTube videos even if they or the channel which uploaded them are being deleted or taken down, I created a Linux shell script. It makes use of youtube-dl, a little command line tool for downloading stuff from video websites. I recommend you to download youtube-dl directly from the source instead of getting it via the repos of your Linux distro. That's because YouTube is well known for changing something technical in the background that could potentially break youtube-dl. The program has an integrated update function so updates can come in much faster than they might roll out to Linux distro repos.

Click here to get the script. The comments in the code explain, what needs to be configured. The script checks for updates for youtube-dl and – if nessecary – performs them. At the bottom there are two example lines that show how to add the channels that should be archived. Simply call the archive function with the first argument being the directory name within the archive directory and the secound argument being the part of the channel URL after In channel directories, each video gets an own directory named after it's ID on YouTube. Each video directory contains five files:

You can run the script manually every now and then or just configure it as a cronjob.