Skip to content

Commit

Permalink
Rebase hell
Browse files Browse the repository at this point in the history
  • Loading branch information
techno-sam committed Dec 1, 2024
1 parent fa0a818 commit 0231e3a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions gen_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python3
import urllib.request
import json

names = []

with open("dev_capes.txt") as f:
for line in f:
names.append(line.strip())

names = list(set(names))
names = [name for name in names if name != ""]

uuids = {}

for i, name in enumerate(names):
print(f"[{i+1}/{len(names)}] Fetching UUID for {name}")
with urllib.request.urlopen("https://api.ashcon.app/mojang/v2/user/"+name) as f:
dat = json.load(f)
uuids[name] = dat["uuid"]


full_data = {
"dev": [
{
"id": v,
"name": k
} for k, v in uuids.items()
]
}

full_data["dev"] = sorted(full_data["dev"], key=lambda v: v["id"])

with open("dev_capes.json", "w") as f:
json.dump(full_data, f, indent=4)

0 comments on commit 0231e3a

Please sign in to comment.