Obtaining Bedrock versions automatically

Heya @hexparrot.

Whilst updating my PR, I can add updated bedrock versions manually, but this is less than ideal.
I believe you must have had this issue for java edition prior until an xml was published.

The only semi-reliable source I can find is Bedrock Dedicated Server – Minecraft Wiki
It would be impossible to split out beta vs production releases.

Alternatively I could host a semi-automated xml generator and scrape off that, but that would also provide a central point of failure.

Thoughts?

I’m perhaps mindful to get this current PR in, then improve the scraping method.

Jez

For example, here’s a junkscript example:

var async = require('async');
var request = require('request');
var jsdom = require('jsdom');
const { JSDOM } = jsdom;

var request_args = {
  url: 'https://minecraft.fandom.com/wiki/Bedrock_Dedicated_Server',
  json: false
};

const isServerZip = (link) => {
  // Return false if there is no href attribute.
  if(typeof link.href === 'undefined') { return false }

  return link.href.includes('minecraft.azureedge.net/bin-linux/bedrock-server');
};

// grab the wiki page
request(request_args, (err,res,body) => {

  // parse the dom
  const dom = new JSDOM(body);

  // Create an Array out of the HTML Elements for filtering using spread syntax.
  const nodeList = [...dom.window.document.querySelectorAll('a')];

  // print matching elements
  nodeList.filter(isServerZip).forEach(link => {
    console.log(link.href);
  });

});

Which results in:

jtucker@elmo:~/development/junkscripts/js/bedrockvers$ node bedrockvers.js 
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.6.0.15.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.6.1.0.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.7.0.13.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.8.0.24.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.8.1.2.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.9.0.15.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.10.0.7.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.0.23.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.1.2.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.2.1.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.4.2.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.12.0.28.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.13.0.34.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.13.1.5.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.13.2.0.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.13.3.0.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.0.9.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.1.4.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.20.1.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.21.0.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.30.2.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.32.1.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.60.5.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.0.2.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.1.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.20.03.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.40.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.100.04.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.101.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.200.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.201.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.201.03.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.210.05.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.210.06.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.220.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.221.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.0.03.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.1.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.2.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.10.04.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.11.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.30.04.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.31.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.32.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.33.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.34.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.40.06.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.17.41.01.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.18.0.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.18.1.02.zip
https://minecraft.azureedge.net/bin-linux/bedrock-server-1.18.2.03.zip

How useful is having older versions of bedrock? I think most devices would require updating to newest to play.

This is fair comment.

Personally, I use MCPELauncher on Ubuntu - so in this instance I can choose the version I want to launch ala Java.
Similarly in Android you can pin the app version should you so desire.

I think I am at: can implement either approach, what would everyone like me to do; stage.