Skip to content

Instantly share code, notes, and snippets.

@aliva
Forked from psamim/wget.sh
Created October 9, 2013 19:45
Show Gist options
  • Save aliva/6907133 to your computer and use it in GitHub Desktop.
Save aliva/6907133 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
[email protected]
YD_DIR="app-root/data"
DIR="video"
if [ "$1" == "install" ]
then
# SSH To Server
ssh $SSH_ACCOUNT 'bash -s'<<<"
wget https://yt-dl.org/downloads/2013.10.07/youtube-dl -O \$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl --no-check-certificate
chmod +x \$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl
"
exit
fi
# SSH To Server
ssh $SSH_ACCOUNT 'bash -s'<<ENDSSH
# Get File Name
filename=\`"\$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl" --get-filename \
-o "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/%(id)s.%(ext)s" $1\`
# Get Video
"\$OPENSHIFT_HOMEDIR/$YD_DIR/youtube-dl" \
-o "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/$DIR/%(id)s.%(ext)s" $1
# Gives Full URL
echo "http://\$OPENSHIFT_APP_DNS/$DIR/\$(basename "\$filename")"
ENDSSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment