Skip to content

Instantly share code, notes, and snippets.

@joepie91
Last active October 28, 2015 04:50
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joepie91/c9bff240ae06b581a4b6 to your computer and use it in GitHub Desktop.
Uploading to curl.io without a browser (but with a progress bar!)

Simply save the script in your home directory (as set-alias.sh or whatever else you want), and add the following to your .bashrc:

source ~/set-alias.sh

Don't forget to use the right filename if you've changed it!

Now you can just use the curlio command:

sven@linux-etoq:~/archive/maagdenhuis_videos> curlio maagdenhuis4.flv 
######################################################################## 100.0%
http://curl.io/get/grlpigul/b0237b039e8e655a5b8c4723282aa9ae56c0e6a1

Note: You'll need to have jq installed for this to work! It's probably shipped by your distribution.

function curlio {
curl --progress-bar -F "file=@$1" "https://curl.io/send/$(curl -s "https://curl.io/socket.io/?EIO=3&transport=polling&t=$(date +%s)-1&sid=$(curl -s "https://curl.io/socket.io/?EIO=3&transport=polling&t=$(date +%s)-0" | grep -oEa "\{.+" | jq -r .sid)" | grep -oEa "\[.+" | jq -r '.[1]')" | grep -oE https://curl.io/get/.+
}
export -f curlio
@dizda
Copy link

dizda commented Sep 14, 2015

Wow dude, you've just posted a such nice way to workaround the progressbar & the upload directly from the terminal.
Well done!

@dizda
Copy link

dizda commented Sep 14, 2015

Just one thing, the result url is not printed.

➜  Downloads  curlio vpnvision-mac.zip
######################################################################## 100.0%
➜  Downloads

@joepie91
Copy link
Author

I've fixed the script. They seem to have switched to forced HTTPS, so that's what broke it.

It should work again now!

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