Last active
July 1, 2022 03:35
-
-
Save rene-d/1ca875920e684b8dcad6da712e812166 to your computer and use it in GitHub Desktop.
Commandline downloader for uptobox.com
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
| #!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nota: this version only works for premium accounts