Skip to content

Instantly share code, notes, and snippets.

Last active August 9, 2017 10:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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