Skip to content

Conversation

@robzr
Copy link
Contributor

@robzr robzr commented Jun 13, 2025

See #524 for issue.

itzg
itzg previously approved these changes Jun 13, 2025
Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the root cause. Quite annoying they changed after 5+ years.

@robzr
Copy link
Contributor Author

robzr commented Jun 13, 2025

Tried this locally, and it's not fixing it; the restify command still isn't returning the right URL. I wonder if it is because they wrapped serverBedrockLinux in double quotes?

@itzg
Copy link
Owner

itzg commented Jun 13, 2025

I don't see any extra double quotes, but I definitely need to investigate if there's a bug in restify

<a href="https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.84.1.zip" class="MC_Button MC_Button_Hero_Outline MC_Glyph_Download_A MC_Style_Core_Green_5" aria-label="serverBedrockLinux" data-aem-contentname="primary-cta" id="MC_Download_Server_2" target="_blank" data-bi-id="MC_Download_Server_2" data-bi-ct="button" data-bi-cn="primary-cta" data-bi-ecn="primary-cta" data-bi-bhvr="DOWNLOAD">
				<span>Download</span>
			</a>

@robzr
Copy link
Contributor Author

robzr commented Jun 13, 2025

Is this new? Looks like it's now referring to an API to get the link URLs:

$ curl -sL https://net-secondary.web.minecraft-services.net/api/v1.0/download/links | jq .
{
  "result": {
    "links": [
      {
        "downloadType": "serverBedrockWindows",
        "downloadUrl": "https://www.minecraft.net/bedrockdedicatedserver/bin-win/bedrock-server-1.21.84.1.zip"
      },
      {
        "downloadType": "serverBedrockLinux",
        "downloadUrl": "https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.84.1.zip"
      },
      {
        "downloadType": "serverBedrockPreviewWindows",
        "downloadUrl": "https://www.minecraft.net/bedrockdedicatedserver/bin-win-preview/bedrock-server-1.21.100.20.zip"
      },
      {
        "downloadType": "serverBedrockPreviewLinux",
        "downloadUrl": "https://www.minecraft.net/bedrockdedicatedserver/bin-linux-preview/bedrock-server-1.21.100.20.zip"
      },
      {
        "downloadType": "serverJar",
        "downloadUrl": "https://piston-data.mojang.com/v1/objects/e6ec2f64e6080b9b5d9b471b291c33cc7f509733/server.jar"
      }
    ]
  }
}

Which makes this easy:

$ curl -sL https://net-secondary.web.minecraft-services.net/api/v1.0/download/links | jq --arg platform serverBedrockLinux -r '.result.links[] | select(.downloadType == $platform) | .downloadUrl'
https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.84.1.zip

@itzg
Copy link
Owner

itzg commented Jun 13, 2025

Awesome find. Yeah, that's much easier to work with.

Otherwise it looked like their page has broken scraping the link entirely:

    <div data-mc-mount="cardIApp" data-mc-config-strings="{\x22card1\x22:{\x22headingTagName\x22:\x22h2\x22,\x22version1_Text\x22:\x22Windows\x22,\x22softwareSelect_Text\x22:\x22Select software version:\x22,\x22downloadType1\x22:\x22serverBedrockWindows\x22,\x22subheading_Text\x22:\x22\\u003cp\\u003eUnzip the container file into an empty folder. Start the server by executing the bedrock_server.exe file.\\u003c\/p\\u003e\\u003cp\\u003eFollow the bundled how to guide to configure the server.\\u003c\/p\\u003e\x22,\x22version2_Text\x22:\x22Window Preview\x22,\x22heading_Text\x22:\x22Minecraft Dedicated Server Software for Windows\x22,\x22softwareSelectTagName\x22:\x22h3\x22,\x22downloadType2\x22:\x22serverBedrockPreviewWindows\x22},\x22card2\x22:{\x22headingTagName\x22:\x22h2\x22,\x22version1_Text\x22:\x22Ubuntu (Linux)\x22,\x22softwareSelect_Text\x22:\x22Select software version:\x22,\x22downloadType1\x22:\x22serverBedrockLinux\x22,\x22subheading_Text\x22:\x22\\u003cp\\u003eUnzip the container file into an empty folder. Start the server with the following command:\\u003c\/p\\u003e\\u003cp\\u003eLD_LIBRARY_PATH\\u003d..\/bedrock_server\\u003c\/p\\u003e\\u003cp\\u003eFollow the bundled how to guide to configure the server.\\u003c\/p\\u003e\x22,\x22version2_Text\x22:\x22Ubuntu (Linux) Preview\x22,\x22heading_Text\x22:\x22Minecraft Dedicated Server Software for Ubuntu (Linux)\x22,\x22softwareSelectTagName\x22:\x22h3\x22,\x22downloadType2\x22:\x22serverBedrockPreviewLinux\x22},\x22cardGlobal\x22:{\x22consentLabel_Text\x22:\x22consent\x22,\x22backgroundColor\x22:\x22MC_Bg_Core__off\u002Dblack\x22,\x22consent_Text\x22:\x22\\u003cp\\u003eI agree to the \\u003ca href\\u003d\\u0026#34;https:\/\/minecraft.net\/eula\\u0026#34;\\u003eMinecraft End User License Agreement\\u003c\/a\\u003e and \\u003ca href\\u003d\\u0026#34;https:\/\/go.microsoft.com\/fwlink\/?LinkId\\u003d521839\\u0026#34; target\\u003d\\\x22_blank\\\x22\\u003ePrivacy Policy\\u003c\/a\\u003e\\u003c\/p\\u003e\x22,\x22download_Text\x22:\x22Download\x22,\x22headingClass\x22:\x22MC_Heading_2\x22,\x22headingStyle\x22:\x22MC_Core_HeadingStyle\x22,\x22theme\x22:\x22MC_Theme_Vanilla\x22,\x22filterLabel_Text\x22:\x22filter radio options\x22},\x22header\x22:{\x22headingTagName\x22:\x22h1\x22,\x22subheading_Text\x22:\x22\\u003cp\\u003eIf you want to run a multiplayer server for Minecraft, start by downloading the Bedrock Dedicated Server for either Windows or Ubuntu (Linux).\\u003c\/p\\u003e\\u003cp\\u003eIf you are interested in modding Bedrock Server, you can find protocol documentation \\u003ca href\\u003d\\u0026#34;https:\/\/github.com\/Mojang\/bedrock\u002Dprotocol\u002Ddocs\\u0026#34;\\u003ehere\\u003c\/a\\u003e.\\u003c\/p\\u003e\x22,\x22heading_Text\x22:\x22Download Free Minecraft Bedrock Servers\x22}}">
    </div>

@itzg
Copy link
Owner

itzg commented Jun 13, 2025

If you want to change to use the curl+jq approach, then that would be awesome.

@itzg
Copy link
Owner

itzg commented Jun 13, 2025

...I can later remove the use of https://github.com/itzg/mc-bds-helper since that was just to cache the scraping result as a fallback.

@robzr
Copy link
Contributor Author

robzr commented Jun 13, 2025

Cool! I'll put a PR in... will add some validation in case the platform is not present too

EDIT - will fix this PR

@robzr
Copy link
Contributor Author

robzr commented Jun 13, 2025

This works, but we need to figure out how to lookup custom version URLs via the new API to re-add support for versions other than latest. Also, if curl or jq fails, then the entry script fails. I'll fix it to pass an error message through gracefully so it can use a cached version. But for anyone stuck with a broken server, this will get them going!

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Yeah I would expect the latest version lookup to be the 99% use case, so this is fantastic at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minecraft download script broken - "Failed to locate data-platform element" on startup

2 participants