I've been creating a Python utility that manages some of the more repetitive tasks of owning and setting up a Minecraft server. Part of this utility is responsible for pulling the HTML for the server download page (https://www.minecraft.net/en-us/download/server). It would then parse that HTML for the most recent server.jar download URL then subsequently pull the JAR.
I had this working perfectly for at least a month up until yesterday evening. While making some updates to the utility and testing this function suddenly stopped working and hung. Using the wget command within Linux I attempted to pull the HTML for the same page and it sat waiting for a response from your web servers. Trying a dozen times with no positive results I switched over to cURLt to see if I could pull that server download page. Upon executing the command I instantly received an Access Denied message.
Finding this odd for I switched over to a browser then attempted to travel to that server download page. Upon trying I was able to successfully access the page with no issues. Therefore it appears that for some reason your web servers aren't liking requests from applications like wget/cURL. I tried these same tests on a server I own in a different geographical region but received the same results. Were there some changes recently made on your end that caused this to happen? ...or is it possible that I might have tripped a security mechanism?
Linked issues
Comments 4
I have the exact same problem, I cannot download the latest version automatically.
I'd love using the API instead, but I'm afraid it's not bedrock ready as I can't figure out how parsing the manifest.json in order to build https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.11.01.zip
I don't know about wget but there's a workaround for curl...
It seems that the server download page is checking that the request is being made by a "known" web browser so you can set the "user-agent" Header to make curl look like a specific web browser.
For example, to make the curl request look like it's coming from a Chrome browser on Mac you can specify the curl option:
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)'
I hope that posting this workaround here doesn't incite Mojang to further restrict access to the download page! 😞
You should use the API instead of parsing the HTML. See https://wiki.vg/Game_files#Game