-
-
Save shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8 to your computer and use it in GitHub Desktop.
Download workupload files via curl
This file contains hidden or 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 :)" |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does not seem to work anymore.