misukisu commited on
Commit
6e18cb7
·
verified ·
1 Parent(s): 0571834

Delete download_bedrock.py

Browse files
Files changed (1) hide show
  1. download_bedrock.py +0 -34
download_bedrock.py DELETED
@@ -1,34 +0,0 @@
1
- import json
2
- import urllib.request
3
- import zipfile
4
- import io
5
- import sys
6
-
7
- headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
8
- download_url = None
9
-
10
- print("Checking Mojang API for latest Bedrock Dedicated Server...")
11
- try:
12
- req = urllib.request.Request("https://net.web.minecraft-services.net/api/v1.0/download/links", headers=headers)
13
- with urllib.request.urlopen(req, timeout=15) as res:
14
- data = json.loads(res.read().decode('utf-8'))
15
- for link in data.get("result", {}).get("links", []):
16
- url = link.get("url", "")
17
- if "bin-linux" in url:
18
- download_url = url
19
- break
20
- except Exception as e:
21
- print(f"API query failed ({e}), falling back to direct server URL...")
22
-
23
- # Fallback in case API endpoint is unreachable
24
- if not download_url:
25
- download_url = "https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.60.10.zip"
26
-
27
- print(f"Downloading from: {download_url}")
28
- req = urllib.request.Request(download_url, headers=headers)
29
- with urllib.request.urlopen(req) as resp:
30
- zip_bytes = io.BytesIO(resp.read())
31
- with zipfile.ZipFile(zip_bytes) as z:
32
- z.extractall("/bedrock")
33
-
34
- print("Bedrock Dedicated Server extracted successfully!")