mixdrop added; highload and videovard changed

This commit is contained in:
Tidoni 2022-03-05 10:20:40 +01:00
parent d9cf782f63
commit 67a7d2504d
3 changed files with 66 additions and 2 deletions

View file

@ -35,7 +35,7 @@ function upload_to_highload () {
hoster_url="https://highload.to/f/$hoster_url"
>&2 echo "hoster_url: $hoster_url"
if [ "$hoster_url" != "" ] && [ "$hoster_url" != "null" ]; then
if [ "$hoster_url" != "" ] && [ "$hoster_url" != "null" ] && [ "$hoster_url" != "https://highload.to/f/" ]; then
echo "$hoster_url"
else
echo ""

64
mixdropFunctions.fn Normal file
View file

@ -0,0 +1,64 @@
#!/bin/bash
function upload_to_mixdrop () {
api_login=$1
api_key=$2
filepath=$3
filepath=$( readlink -f "$filepath" )
echo "filepath: $filepath" >&2
filesize=$(stat -c%s "$filepath")
echo "filesize: $filesize" >&2
hoster_url=$(curl -X POST -F email=$api_login -F key=$api_key -F "file=@\"$filepath\"" "https://ul.mixdrop.co/api")
echo "hoster_url: $hoster_url" >&2
hoster_url=$(echo $hoster_url | jq ".result")
# hoster_filename=$(echo $hoster_url | jq ".name")
# hoster_url=$(echo $hoster_url | jq ".[0]")
hoster_url=$(echo $hoster_url | jq ".fileref")
hoster_url=${hoster_url//\"}
hoster_url="https://mixdrop.co/f/$hoster_url/"
>&2 echo "hoster_url: $hoster_url"
if [ "$hoster_url" != "" ] && [ "$hoster_url" != "null" ] && [ "$hoster_url" != "https://mixdrop.co/f//" ] && [ "$hoster_url" != "https://mixdrop.co/f/" ]; then
echo "$hoster_url"
else
echo ""
fi
}
function mixdrop_check_if_file_is_alive () {
api_login=$1
api_key=$2
file_url=$3
>&2 echo "file_url: $file_url"
file_id=${file_url%/*}
# >&2 echo "File ID: $file_id"
file_id=${file_id##*/}
>&2 echo "File ID: $file_id"
>&2 echo "URL to call: https://api.highload.to/file/info?file=$file_id&login=$api_login&key=$api_key"
response=$(curl -s -X GET "https://api.mixdrop.co/fileinfo?email=$api_login&key=$api_key&ref[]=$file_id" -H "Content-Type: multipart/form-data")
>&2 echo "Response: $response"
is_alive=$(echo $response | jq ".success")
# is_alive=$(echo $is_alive | jq ".[0]")
# is_alive=$(echo $is_alive | jq "first(.[])")
# is_alive=$(echo $is_alive | jq ".deleted")
# >&2 echo $is_alive
if [ "$is_alive" == "false" ]; then
echo "false"
# elif [ $is_alive = '500' ]; then
# echo "false"
else
echo "true"
fi
}

View file

@ -35,7 +35,7 @@ function upload_to_videovard () {
hoster_url="https://videovard.sx/v/$hoster_url"
>&2 echo "hoster_url: $hoster_url"
if [ "$hoster_url" != "" ] && [ "$hoster_url" != "null" ]; then
if [ "$hoster_url" != "" ] && [ "$hoster_url" != "null" ] && [ "$hoster_url" != "https://videovard.sx/v/" ]; then
echo "$hoster_url"
else
echo ""