I want to upload to YouTube without having to use the web interface in order to automate some things. Is there a way to upload from the command line in OSX?
You could give this open source project a try http://code.google.com/p/youtube-upload/
Use GoogleCL, the universal Google command line client. It's implemented in Python and therefore cross-platform. Unlike youtube-upload it uses proper OAuth2 authentication, so you're not typing in or sending your Google account password in plain text.
Install via pip:
Uploading a video is as simple as:
Use this straightforward tutorial on accessing the standard Youtube Cloud API, takes 10 mins to setup and gets the job done:
Google happens to have its own upload_video.py script, and I could make it work with some, or rather a lot of, efforts mainly because of authentication. There’s probably a better way (comments welcome), but here’s what I had to do in Ubuntu 14.04, although I should work as well for 12.04 / 13.10:
Download the script:
Download and extract Google API Python Client, and move relevant directories to the directory where the script is located:
In a computer with a Desktop interface, create a project called “Youtube Upload Script” with Google Cloud Console (the name and id does not matter) using the YouTube credential, and Enable YouTube Data API v3 in APIs & auth->API. In Credentials, click on CREATE NEW CLIENT ID, select Installed application for Application Type, and Other for Installed application type, and click Create Client ID. You should now have a Client ID for native application that looks like:
Back to the command line, create a file client_secrets.json vi your preferred editor (e.g. nano, vi, …), with the Client ID, Client secret, and redirect URIs above:
Now you can upload a video to your YouTube account with the script. There are two cases: You have access to a desktop browser such as Chromium or Firefox on the machine where the script is executed:
privacyStatus lets you choose between unlisted, private or public. The machine where the script is executed does not have access to a desktop browser, and you need to use a browser in another machine, run the following command instead:
I’ve tested it myself with with one of our videos and it went pretty quickly, from a VPS.