Skip to content

Instantly share code, notes, and snippets.

@pirafrank
Created November 14, 2016 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirafrank/20ecefda12e8bb47fe4eba59621b08ff to your computer and use it in GitHub Desktop.
Save pirafrank/20ecefda12e8bb47fe4eba59621b08ff to your computer and use it in GitHub Desktop.
Quick script to automate video upload from CLI to YouTube. Replace 'francesco' with your own username.
#!/bin/bash
# Quick script to automate video upload from CLI to YouTube.
# More info and requirements at https://github.com/tokland/youtube-upload
# BEFORE starting: replace 'francesco' with your own username to make it work!
if [[ $# != 3 ]]; then
echo "Error: wrong number of arguments. It should be 3, you put $#."
echo "Usage: ./youtube-uploader-cli.sh [video title] [video path] [public | unlisted | private]"
exit -1
fi
# running vars
VIDEO_TITLE="$1"
VIDEO_PATH="$2"
PRIVACY="$3"
# pre-set vars
CLIENT_SECRETS="/home/francesco/.config/youtube-upload/client_secrets.json"
CRED_FILE="/home/francesco/.config/youtube-upload/youtube-upload-credentials.json"
if [[ $(whoami) != "francesco" ]]; then
echo "This script must be run by francesco users! Exiting..."
exit 1
fi
PYTHONPATH=. python /home/francesco/documents/youtube-upload-master/bin/youtube-upload --title "$VIDEO_TITLE" "$VIDEO_PATH" --client-secrets=$CLIENT_SECRETS --credentials-file=$CRED_FILE --privacy=$PRIVACY
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment