Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Emoji list generator for
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Generate emoji list json file for mdx_unimoji(
You can convert emoji_strategy.json on emojione ( into
`{"ENTITY1": ["NAME1"], "ENTITY2": ["NAME2", "ALTERNAME2", ...], ...}`.
$ ./
Run with no parameter to pass json data from stdin.
$ curl | \
./ > emoji.json
import json
import sys
from urllib.request import urlopen
def main(text):
"""Generate emoji table function."""
emojson = json.loads(text)
emojis = dict()
for x in emojson.values():
code = "".join([chr(int(c, base=16)) for c in x["unicode_output"].split("-")])
emojis[code] = [x["shortname"]] + x["shortname_alternates"]
return emojis
if __name__ == "__main__":
if len(sys.argv) > 1:
text = urlopen(sys.argv[1]).read().decode("utf-8")
text = input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.