Skip to content

Instantly share code, notes, and snippets.

@ohhdemgirls
Last active January 2, 2016 13:09
Show Gist options
  • Save ohhdemgirls/8308000 to your computer and use it in GitHub Desktop.
Save ohhdemgirls/8308000 to your computer and use it in GitHub Desktop.
mediacru.sh rehoster
#!/bin/bash
#Usage: ./mediacru.sh $(cat urls.txt)
echo -e "\e[91mMediaCrush Rehoster\e[0m"
for f in "$@"; do
echo -ne "\e[34mUploading:\e[0m" $f
url="https://mediacru.sh/api/upload/url"
out=$(curl -s -F "url=$f" "$url")
hash=$(echo $out |sed -nre 's#.*"hash": "([^"]+)".*#\1#p')
if [[ $images == "" ]];then images="$hash";else images="$images,$hash";fi
echo -e "\r\033[K\e[92mUploaded:\e[0m" https://mediacru.sh/$hash;done
echo;echo -e "\e[34mAdding images to album...\e[0m"
out=$(curl -s -F "list=$images" "https://mediacru.sh/api/album/create")
hash=$(echo $out |sed -nre 's#.*"hash": "([^"]+)".*#\1#p')
clear;echo -e "\e[92mSuccessfully Rehosted:\e[0m" https://mediacru.sh/$hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment