Skip to content

Instantly share code, notes, and snippets.

@shawnli87
Forked from rexlManu/workupload_download.sh
Created August 27, 2022 04:47
Show Gist options
  • Save shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8 to your computer and use it in GitHub Desktop.
Save shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8 to your computer and use it in GitHub Desktop.
Download workupload files via curl
#!/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
Copy link

DarrenPIngram commented Sep 1, 2022 via email

@Qubits01
Copy link

does not seem to work anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment