Last active
January 2, 2016 13:09
-
-
Save ohhdemgirls/8308000 to your computer and use it in GitHub Desktop.
mediacru.sh rehoster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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