Skip to content

Instantly share code, notes, and snippets.

@psamim
Last active December 25, 2015 02:59
Show Gist options
  • Save psamim/6906099 to your computer and use it in GitHub Desktop.
Save psamim/6906099 to your computer and use it in GitHub Desktop.
Download Leecher
#!/usr/bin/env bash
[email protected]
DIR="files"
# SSH To Server
ssh $SSH_ACCOUNT 'bash -s'<<ENDSSH
# Get File Name
filename=\`date +%s\`
# Get File
wget -P "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/$DIR/" -O "\$OPENSHIFT_HOMEDIR/app-root/runtime/repo/diy/$DIR/\$filename" $1
# Gives Full URL
echo "http://\$OPENSHIFT_APP_DNS/$DIR/\$filename"
ENDSSH
#!/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
@psamim
Copy link
Author

psamim commented Oct 9, 2013

youtube-dl

Usage

Download video to server, give the direct URL, pipe it.

$ ./youtube-dl.sh "http://youtube.com/xxxxx"
$ ./youtube-dl.sh "-f webm -q http://youtube.com/xxxxx" | xargs aria2c

Get formats

$ ./youtube-dl.sh "-F http://youtube.com/xxxxx"

Install

Install DIY cartridge on Openshift, change first line of script, then install youtube-dl on server by running

$ ./youtube-dl.sh install

wget

Usage

Download file to server, give the direct URL, pipe it.

$ ./wget.sh "--q http://virtualbox.com.com/xxxxx" | xargs aria2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment