Browse Source

Fix gofile.io download: getServer is not used by the website anymore, and getUpload no longer returns the MD5

master
JustAnotherArchivist 3 years ago
parent
commit
06cf71f73d
1 changed files with 3 additions and 13 deletions
  1. +3
    -13
      gofile.io-dl

+ 3
- 13
gofile.io-dl View File

@@ -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

Loading…
Cancel
Save