Skip to content

Instantly share code, notes, and snippets.

@kevinchappell
Last active April 9, 2016 16:54
Show Gist options
  • Save kevinchappell/ee074e114b59b1003e929077a0955a49 to your computer and use it in GitHub Desktop.
Save kevinchappell/ee074e114b59b1003e929077a0955a49 to your computer and use it in GitHub Desktop.
Right-click upload to youtube
#!/bin/sh
# youtube-upload
# Dependencies: xclip and [youtube-upload](https://github.com/tokland/youtube-upload)
GREEN='\033[0;32m'
NC='\033[0m' # No Color
read -p 'Title (default filename): ' TITLE # defaults to filename
read -p 'Privacy (public | unlisted | private): ' PRIVACY # defaults to unlisted
read -p 'Tags (comma separated): ' TAGS # no default
PRIVACY="--privacy ${PRIVACY:-unlisted}"
CREDENTIALS='--credentials-file=/path/to/credentials.json'
if [ $TAGS ]; then
TAGS="--tags=\"${TAGS:-}\""
fi
VIDEO_ID="$(youtube-upload "$1" $PRIVACY --title="${TITLE:-$2}" $TAGS $CREDENTIALS | tail -1)"
VIDEO_URL="https://www.youtube.com/watch?v=$VIDEO_ID"
echo "$VIDEO_URL" | xclip -selection clipboard
echo "Edit: https://www.youtube.com/edit?o=U&video_id=$VIDEO_ID"
echo "${GREEN}Finished${NC}"
read -p "${VIDEO_URL} has been copied to your clipboard. Press any key to continue." CLOSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment