Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.