summaryrefslogtreecommitdiff
path: root/bin/emoji-list.py
blob: 81b73ea5cba57d4294767f0bfd432d0da02ab8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json, os, urllib

emoji_list = json.load(urllib.urlopen(
    'https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json'
))
dictionary = {}
for emoji in emoji_list:
    character = ''.join([unichr(int(nibble, 16)) for nibble in emoji['unified'].split('-')])
    name = emoji['name'].replace(' ', '_') if emoji['name'] else emoji['short_name'].upper().replace('-', '_')
    dictionary[character] = ' <%s> ' % (name)

json.dump(dictionary, file(os.path.join(
    os.path.dirname(os.path.realpath(__file__)),
    '../config/emoji.json'
), 'w'))