Skip to content

Instantly share code, notes, and snippets.

@rene-d
Last active July 1, 2022 03:35
Show Gist options
  • Save rene-d/1ca875920e684b8dcad6da712e812166 to your computer and use it in GitHub Desktop.
Save rene-d/1ca875920e684b8dcad6da712e812166 to your computer and use it in GitHub Desktop.
Commandline downloader for uptobox.com
#!/usr/bin/env bash
# how to find the token: https://docs.uptobox.com/?javascript#how-to-find-my-api-token
token=
dl()
{
file_code=$1
file_code=${file_code##https://uptobox.com/}
file_code=${file_code##http://uptobox.com/}
file_code=${file_code/\?*/}
file_code=${file_code/\/*/}
password=$(echo "$1" | sed 's/^.*password=\([^&]*\).*$/\1/p;d')
url="https://uptobox.com/api/link?token=${token}&file_code=${file_code}&password=${password}"
link=$(curl -sL "${url}")
echo "Response:"
echo "${link}" | jq .
message=$(echo "${link}" | jq -rc .message)
if [ "${message}" = "Success" ]; then
dlLink=$(echo "${link}" | jq -rc .data.dlLink)
wget -c "${dlLink}"
fi
}
if [ -f $1 ]; then
cat $1 | xargs -n1 "$0"
else
for i; do
dl "$i"
done
fi
@rene-d
Copy link
Author

rene-d commented Jan 3, 2020

Nota: this version only works for premium accounts

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