update emoji list to be more like the old one but still good
This commit is contained in:
parent
ef75fd81a4
commit
295f3907e6
3 changed files with 5806 additions and 1766 deletions
|
|
@ -1,13 +1,20 @@
|
|||
# python in a js project? lunacy
|
||||
|
||||
import json, requests
|
||||
import requests, json, re
|
||||
|
||||
emojiListSrc = requests.get("https://github.com/muan/unicode-emoji-json/raw/refs/heads/main/data-by-emoji.json")
|
||||
emojiList = json.loads(emojiListSrc.content)
|
||||
newEmojiList = {}
|
||||
emojilistraw = requests.get("https://github.com/xCykrix/discord_emoji/raw/refs/heads/main/mod.ts")
|
||||
emojilistraw = emojilistraw.text
|
||||
|
||||
for emoji in emojiList:
|
||||
newEmojiList[emojiList[emoji]["slug"]] = emoji
|
||||
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")
|
||||
|
||||
output = open("../static/emoji.json", "w+")
|
||||
output.write(json.dumps(newEmojiList, indent=4, ensure_ascii=False))
|
||||
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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue