Created
March 11, 2017 08:12
-
-
Save kakakaya/004bdb8de0099b4e1783117055802790 to your computer and use it in GitHub Desktop.
http://unicode.org/emoji/charts/full-emoji-list.html のfull-emoji-list.html から全てのemojiをJSONの配列で吐き出す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
# Author: kakakaya, Date: Tue Dec 13 12:20:26 2016 | |
# from pprint import pprint as p | |
from bs4 import BeautifulSoup | |
import json | |
def main(): | |
# read html | |
with open("full-emoji-list.html") as f: | |
html_doc = f.read() | |
soup = BeautifulSoup(html_doc, 'html.parser') | |
table = soup.find('table') | |
td = table.find_all('td', attrs={'class': 'chars'}) | |
unicode_emojis = [i.text for i in td] | |
# writeout | |
with open("unicode.json", 'w') as f: | |
f.write(json.dumps(unicode_emojis)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment