-
-
Save shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8 to your computer and use it in GitHub Desktop.
Download workupload files via curl
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 | |
[ -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 :)" |
DarrenPIngram
commented
Sep 1, 2022
via email
Perfect, thank you very much!
…On Tue, 30 Aug 2022 at 14:53, shawnli87 ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
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.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/f226b4f0c7b2bef2e94477ccef00b0c8#gistcomment-4284346>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV5MAHU47XUOQBACZSY37DV3XY5HANCNFSM6AAAAAAQAJYWHQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
does not seem to work anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment