-
-
Save shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
[ -z "$1" ] && echo "Usage: workupload_download.sh '<workupload link>'" && exit 1 | |
id_string=$(sed 's|.*workupload.com/||g' <<< "$1") | |
type=$(cut -d'/' -f1 <<< "$id_string") | |
id=$(cut -d'/' -f2 <<< "$id_string") | |
[[ "$type" != "file" ]] && [[ "$type" != "archive" ]] && echo "Invalid link provided" && exit 1 | |
if [[ "$type" == "file" ]] ; then | |
start_url='https://workupload.com/start/'"$id" | |
elif [[ "$type" == "archive" ]] ; then | |
start_url='https://workupload.com/archive/'"$id"'/start' | |
fi | |
echo "Getting token from workupload servers" | |
token=$(curl -s -c - "$1" | tail -n1 | awk '{ print $7 }') | |
echo "Getting download url from workupload servers" | |
dl_url=$(curl -H 'Cookie: token='"$token" 'https://workupload.com/api/'"$type"'/getDownloadServer/'"$id" 2>/dev/null | jq -r '.data.url') | |
echo "Starting to download the actual file" | |
curl -H 'Cookie: token='"$token" "$dl_url" -s -O -J --compressed | |
echo "Download finished. Have a happy day :)" |
Thanks for going to this effort. I tried it just using the URL given first.
After a few minutes on my server it was sitting at
./workcloud-dl.sh https://workupload.com/archive/7V3z6mrq Getting token from workupload servers Getting download url from workupload servers Starting to download the actual file
(The only change I made is what I called the script, to make it easier to remember with others).
I saw no errors. Anything I can check? Also would there be scope for a rudimentary healthcheck (x% or so much downloaded)?
I tried to keep as much of the original script unchanged as possible, since I am not the original author. However, removing the '-s' flag from the curl command (on line 24) should yield in a progress bar, IIRC. Not near a computer at the moment to test.
does not seem to work anymore.
Would you happen to know the api endpoint to fetch list of files in archive folder?
Would you happen to know the api endpoint to fetch list of files in archive folder?
No, sorry. I only forked this gist because someone asked me to take a look at it a couple of years ago.
Thanks for going to this effort. I tried it just using the URL given first.
After a few minutes on my server it was sitting at
./workcloud-dl.sh https://workupload.com/archive/7V3z6mrq
Getting token from workupload servers
Getting download url from workupload servers
Starting to download the actual file
(The only change I made is what I called the script, to make it easier to remember with others).
I saw no errors. Anything I can check? Also would there be scope for a rudimentary healthcheck (x% or so much downloaded)?