Working version. Using latest of everything.
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
# minecraft_server_downloader
|
||||
|
||||
Grab the latest minecraft server.jar binary (to hand off to other tools)
|
||||
Grab the latest minecraft server.jar binary.
|
||||
|
||||
Uses Python3 and the Requests library.
|
||||
|
26
fetcher.py
Executable file
26
fetcher.py
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
|
||||
# Fetch some manifests
|
||||
url="https://launchermeta.mojang.com/mc/game/version_manifest.json"
|
||||
stage1 = requests.get(url)
|
||||
latest = stage1.json()["latest"]["release"]
|
||||
|
||||
print("Latest version of Minecraft (Release):",latest)
|
||||
|
||||
# Iterate through the json, grab the manifest of the newest version
|
||||
for version in stage1.json()["versions"]:
|
||||
if latest == version["id"]:
|
||||
# print(version)
|
||||
url = version["url"]
|
||||
|
||||
# Grab it. Print.
|
||||
stage2 = requests.get(url)
|
||||
print("Downloading:",stage2.json()["downloads"]["server"]["url"])
|
||||
|
||||
print("Grabbing server.jar")
|
||||
jarfile = requests.get(stage2.json()["downloads"]["server"]["url"])
|
||||
open("server.jar", "wb").write(jarfile.content)
|
||||
|
||||
print("Done!")
|
Reference in New Issue
Block a user