Skip to content

Instantly share code, notes, and snippets.

@kakakaya
Last active May 1, 2016 16:23
Show Gist options
  • Save kakakaya/3b40a074a6dc7e8717154e85c0aa52e6 to your computer and use it in GitHub Desktop.
Save kakakaya/3b40a074a6dc7e8717154e85c0aa52e6 to your computer and use it in GitHub Desktop.
Google IME用顔文字辞書を http://kaomoji.n-at.me/kaomoji.html から生成
from bs4 import BeautifulSoup
import requests
soup = BeautifulSoup(requests.get("http://kaomoji.n-at.me/kaomoji.html").text, "html.parser")
kaomojis = filter(None, ['かおもじ\t'+i.getText()+'\t顔文字' if '\n' not in i.getText() else None for i in soup.find_all('span', class_='kaomoji')])
with open('kaomoji_dic.txt', 'w') as f:
f.write('\n'.join(kaomojis)+'\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment