mcman icon indicating copy to clipboard operation
mcman copied to clipboard

Downloadable::Spigot 403 Forbidden on spigotmc.org/../download

Open deniz-blue opened this issue 1 year ago • 4 comments

HTTP status client error (403 Forbidden) for url (https://www.spigotmc.org/resources/62325/download?version=523602)     
Error: Max attempts reached while processing Spigot:gsit.62325

deniz-blue avatar Jan 28 '24 06:01 deniz-blue

This appears to be because they put some Cloudflare bot protection up. :(

KishCom avatar Mar 01 '24 19:03 KishCom

welp...

deniz-blue avatar Mar 02 '24 07:03 deniz-blue

I've seen torrent/NZB scrapers use https://github.com/FlareSolverr/FlareSolverr

But: it's brittle and almost certainly breaks Spigot's TOS.

Just an option for anyone willing to undertake the effort.

KishCom avatar Mar 07 '24 17:03 KishCom

TL;DR;

if you're willing to download the latest from spigot, use the URL downloadable type like this:

[[plugins]]
type = "url"
url = "https://api.spiget.org/v2/resources/13730/download"
filename = "sudo-13730.jar"

So initially this one had me a bit confused.

I started to look for an alternative to directly downloading from SpigotMC site when I found the spiget API. I started to look at the code and realized it's already using it.

The confusing part is that the error shows a URL from www.spigotmc.org when I can't find that URL anywhere in the codebase. Another confusing bit was that using the direct spiget as a URL downloadable did work.

It looks like spiget is only caching the latest version of the plugin, but mcman here is being explicit and even if "latest" version is implied, it's trying to download a specific version, and the API is redirecting to the spigotmc site.

I think the fix here would be for mcman to use the shorter download link when the version is omitted or set to latest.

I'll look into this if I have time, but I'm sure one of the regular contributors could do this much more quickly.

Here's my test code:

TMPDIR=$(mktemp -d)
cd $TMPDIR
echo "Changing to $TMPDIR"
mcman init
cat <<EOF >> "$TMPDIR/server.toml"

[[plugins]]
type = "url"
url = "https://api.spiget.org/v2/resources/13730/download"
filename = "sudo-13730.jar"

[[plugins]]
type = "url"
url = "https://api.spiget.org/v2/resources/13730/versions/50366/download"
filename = "sudo-13730.jar"
EOF
cat "$TMPDIR/server.toml"

mcman build

echo
curl https://api.spiget.org/v2/resources/13730/download
echo
curl https://api.spiget.org/v2/resources/13730/versions/50366/download
echo

The last two curl commands output this:

Found. Redirecting to https://cdn.spiget.org/file/spiget-resources/13730.jar
Found. Redirecting to https://spigotmc.org/resources/13730/download?version=50366

TangleRisk avatar Apr 19 '24 17:04 TangleRisk

yall wont believe this but this is fixed on the v2 dev branch, so im closing this issue

deniz-blue avatar Jul 13 '24 10:07 deniz-blue