From 06cf71f73d4c8b8a6643fbfab81436caa5768d98 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sat, 9 Jan 2021 16:49:42 +0000 Subject: [PATCH] Fix gofile.io download: getServer is not used by the website anymore, and getUpload no longer returns the MD5 --- gofile.io-dl | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/gofile.io-dl b/gofile.io-dl index 0f8a65e..1fbdf10 100755 --- a/gofile.io-dl +++ b/gofile.io-dl @@ -16,23 +16,15 @@ else code="${url##*/}" fi -server="$(curl -s "https://apiv2.gofile.io/getServer?c=${code}" | python3 -c 'import json,sys; print(json.loads(sys.stdin.read().strip())["data"]["server"])')" -if [[ ! "${server}" =~ ^srv-file[0-9]+$ ]] -then - echo "Unexpected server value: ${server}" >&2 - exit 1 -fi - -curl -s "https://${server}.gofile.io/getUpload?c=${code}" | python3 -c 'import json,sys; obj = json.loads(sys.stdin.read().strip())'$'\n''for f in obj["data"]["files"].values():'$'\n'' print(f["size"], f["md5"], f["name"], f["link"])' | \ - while read -r size md5 name link +curl -s "https://apiv2.gofile.io/getUpload?c=${code}" | python3 -c 'import json,sys; obj = json.loads(sys.stdin.read().strip())'$'\n''for f in obj["data"]["files"].values():'$'\n'' print(f["size"], f["name"], f["link"])' | \ + while read -r size name link do - if [[ "${name}" == *'/'* || "${link}" == *' '* || "${link}" != "https://${server}.gofile.io/download/"* ]] + if [[ "${name}" == *'/'* || "${link}" == *' '* || ! "${link}" =~ ^https://srv-file[0-9]+\.gofile\.io/download/ ]] then echo 'Cannot download file:' >&2 echo "name: ${name}" >&2 echo "link: ${link}" >&2 echo "size: ${size}" >&2 - echo "md5: ${md5}" >&2 exit 1 fi @@ -51,6 +43,4 @@ curl -s "https://${server}.gofile.io/getUpload?c=${code}" | python3 -c 'import j echo "Size mismatch: expected ${size}, got ${actualSize}" >&2 exit 1 fi - - md5sum -c <<<"${md5} ./${name}" done