Files
minecraft-server-resource-pack/build/scripts/resolve_latest_minecraft_release.py
T

24 lines
565 B
Python

#!/usr/bin/env python3
from __future__ import annotations
import json
from urllib.request import urlopen
VERSION_MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
def main() -> int:
with urlopen(VERSION_MANIFEST_URL, timeout=30) as response:
manifest = json.load(response)
latest_release = manifest["latest"]["release"]
latest_snapshot = manifest["latest"]["snapshot"]
print(latest_release)
print(f"snapshot={latest_snapshot}")
return 0
if __name__ == "__main__":
raise SystemExit(main())