Backup All of Your Photos and Videos… for Free

Upload everything to Flickr and YouTube automatically using these neat Python scripts

Momchil Tomov
8 min readFeb 9, 2014

If you’re anything like me, you are super OCD about your videos and photos. You probably organize them using your own complicated system of directories, categories and albums (of course, you never trust iPhoto or any other stupid app to organize them for you). If you’re anything like me, you are also extremely paranoid about losing your precious memories. You have at least two copies of them, one on your computer and another one on an external hard drive, and you will readily kill anyone who tries to steal or damage them.

Unfortunately, as your collection of memories grows with you, at some point it simply won’t fit on your computer any longer. About a week ago, when my Mac kindly informed me that “Your startup disk is almost full”, I knew that I had to finally do something about that Pictures folder which had bloated to more than 200 gigs over the past 10 years. It simply had to go. However, leaving with a single backup on an external hard drive was not an option — it could crash, get stolen, or I could lose it somewhere (highly likely). I needed to make an extra backup somewhere in the Cloud.

I quickly found out that most cloud backup solutions are far from ideal. Dropbox charges $10 per month. Box, Google Drive, iCloud, SkyDrive, and SugarSync also have limited capacity unless you pay. Picturelife is cheaper but it shoves everything into one ugly gigantic photo stream. Facebook is free but significantly lowers the quality of the images and videos. Vimeo also has limited capacity, and so does Google+.

The only two solutions I found which are free, unlimited, and preserve quality are Flickr and YouTube. The only problem is that there is no convenient way to backup an entire hierarchy of directories with thousands of albums, videos and photos. The Flickr uploader hasn’t been changed since 2009 and is super awkward, and YouTube doesn’t let you upload whole directories.

So I wrote two little Python scripts that automate the process! One script uploads your photos to Flickr and the other one uploads your videos to YouTube. They preserve the integrity of your directory structure by creating corresponding playlists, sets, and collections and arranging your photos and videos inside them. Once you set up the scripts, you can let them run for a few hours to backup all of your stuff, and then you can periodically fire them up to upload any new videos or photos you might have added. You can also set them up to start automatically and run in the background, say, once a day or once a week. And the best part — this is all completely free!

Backing up your photos to Flickr

Let’s backup the photos first.

Step 1. Create a new Flickr account

You would want to use a separate Flickr account for your backup only and for no other purposes (such as sharing photos). Sign up here.

I recommend adding a recovery number and also writing down the login information somewhere safe. You don’t want to lose access to that backup when you need it most. I also recommend not connecting this Flickr account with Facebook.

Step 2. Change your privacy settings

Do that from the Privacy & Permissions settings page. Since we’re uploading all photos here, I would strongly recommend going for maximum privacy settings. Particularly, under Defaults for new uploads, for the setting Who will be able to see, comment on, add notes, or add people, change everything to Only you. Then go down the list and change all settings to maximum restrictions, e.g.

Who can access your original image files?Only you
Allow others to share your stuffNo
Allow your stuff to be added to a galleryNo
Hide your profile from public searchesYes

Etc. Most of these are a little redundant, but you can never be too safe when your entire life is going up in the cloud.

Step 3. Get your API key

Sign up for a new API key on this form. The app name and description don’t really matter since you are the only one who will be using it. For example, you can type in “Flickr uploader” and “Python script for backing up my photo directory”. Select both checkboxes and hit Submit.

On the next page you will get your API key and your API secret. Write those down some place safe (I recommend e-mailing them to yourself). You will need those two strings to connect the Python script to your account.

Step 4. Download and run the script

Go to https://github.com/tomov/uploadr.py, get the script and fire it up to backup all of your photos! Just follow the instructions on the Github page to complete the setup. As for privacy, all photos are uploaded as private, so nobody besides you will be able to see them.

Backing up your videos to YouTube

Now let’s backup the videos.

Step 1. Create a new YouTube account

Again, since you’re using this account for very specific and private purposes, it makes sense to have it separate from your normal YouTube account. First sign out of your regular YouTube account (assuming you have one), then create a new one. I recommend including a phone number and alternative e-mail address for safety. After you verify you account, click Next on all the annoying prompts.

Step 2. Create a new channel

On your YouTube home page, click Upload next to the search bar. A dialog will pop up asking you if you would like to create a new channel for your videos. Hit ‘OK’

Step 3. Get your API key

First go to the Google Cloud Console and click Create Project. Give it some name and ID (e.g. “YouTube Folder Uploader” and “youploader-12345”, or leave the defaults) and tick the Terms of Service checkbox.

Then on the left sidebar, click API’s & auth, then go to the bottom of the page and find the YouTube Data API v3 and the YouTube Analytics API settings. Flip the switches to ON for both of them and accept the Terms of Service.

Again on the left sidebar, click Credentials under API’s & auth. Select CREATE NEW CLIENT ID. In the dialog that pops up, leave on the option for Web application. Then for both URI’s, enter “http://localhost/”. This step is important — if you do not change the origin and redirect URI’s to localhost, the script will fail to authenticate. Note that both URI’s should be the same (i.e. remove the “oauth2callback” suffix from the second one). Click Create Client ID.

A new entry will appear in the list of Client ID’s. Click Download JSON right under it. Rename the JSON file to client_secrets.json and save it in the directory that you will be backing up to YouTube (i.e. where all your videos are). For example, if you are backing up the directory “/Users/john/Movies”, then the file should be saved as “/Users/john/Movies/client_secrets.json”. This file contains the information that the script needs in order to gain access to the YouTube account.

Step 4. Download and run the script

Go to https://github.com/tomov/youtube-upload to download the script and run it! The rest of the instructions are on the Github page. Also, don’t worry about privacy — all videos are uploaded as private, so nobody else will be able to see them.

Risks and Concerns

You might have some questions at this point, such as:

Wait, does this mean that all of my photos and videos will be shared with the entire world?

No. Both Flickr and YouTube allow for private content and the scripts upload everything as private. In any case, you should double check this once some of your files are up. You can either verify the settings of the uploaded content through your account, or you can log off and find your public profile as an anonymous user to make sure nothing is visible to the outside world.

What if Flickr and YouTube go down or go bankrupt and I lose all of my stuff?

Realistically, none of those things will happen. Both websites serve tens of millions of users and have layers upon layers of security measures against crashes and server breakdowns. They are also owned by two of the largest tech corporations (Yahoo and Google) so technically they cannot go bankrupt. In the highly unlikely event that one of the two websites actually decides to shut down, they will surely notify all users way in advance so they have a chance to pull out all of their content.

What if my account gets hacked?

This is a more realistic concern. I recommend opting for the highest security measures for both accounts (two-step verification, etc) and also making sure nobody but you has access to the API token files that the scripts generate. The worst thing that can happen is if someone hacks into your account and deletes all of your content. This is why you should also keep an extra copy of your stuff on your computer or on an external hard drive (I recommend My Passport by Western Digital). You can also check both accounts every now and then to make sure everything is still fine. Finally, nobody is stopping you from creating 10 more backups using 10 new YouTube and Flickr accounts. Remember, this stuff is free. At least for now.

What if your sketchy scripts delete my stuff before it even makes it to the cloud???

Also a realistic concern and another reason why you should have an extra backup on your external hard drive. On a more serious note, the scripts do not alter any files on your computer (besides creating a few log files and a local cache), so you should be safe. If you don’t trust me (and you shouldn’t), I recommend first trying out each script on a small directory with only a few photos or videos just so you see what happens. What the script could actually do though is create thousands of playlists in your YouTube account in a matter of seconds which you will then have to delete one by one. This is why you should not use it on your existing YouTube account but rather create a new one specifically for your backup. Same thing for Flickr.

The scripts don’t work for me… I just get a bunch of error messages…

Did you go over all the instructions carefully? Are you sure you didn’t skip a step or misspell something? Please comment here if you encounter any issues and I will do my best to address them in a timely fashion. Keep in mind I haven’t thoroughly tested the scripts, so bugs will certainly come up. I also don’t recommend using the scripts if you’ve never used Python or the command line before. Lastly, apologies to Windows users, I haven’t really tested the scripts on Windows and I’m sure they’ll require some tweaking to get going.

Recap

It took about an hour to backup 30 gigs of videos to YouTube and several days to back up 160 gigs of photos to Flickr (their bandwidth is very slow for some reason). Since it was just running at in the background, I could still do all my work and just check it from time to time to make sure things are going fine. Now I can finally liberate my Mac from the gigantic monster that my Pictures folder had become without worrying that I might accidentally lose my entire life!

I hope this guide helps you backup all of your precious memories too! Please feel free to fork, update, and distribute the scripts as you see fit.

--

--