# python in a js project? lunacy

import requests, json, re

emojilistraw = requests.get("https://github.com/xCykrix/discord_emoji/raw/refs/heads/main/mod.ts")
emojilistraw = emojilistraw.text

patt1 = re.compile("// deno.*\n.*\n.*\n.*\n.*\n\n.*\n.*= ")
patt2 = re.compile("}\n\n.*\n.*= {\n")
patt3 = re.compile("}\n\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n")

patterns = [patt1, patt2, patt3]

for pattern in patterns:
    emojilistraw = re.sub(pattern, "", emojilistraw)

emojilistparsed = json.loads(emojilistraw.rpartition(",")[0] + "}")

out = open("../static/emoji.json", "w+")
out.write(json.dumps(emojilistparsed, ensure_ascii=False, indent=4))
