瀏覽代碼

Load emojis from emojipedia

... and save them in a Python file. We will later read this file and
push its contents to rofi.

👍🏻
tags/1.2.0
Fabian Winter 3 年之前
當前提交
73da76065a
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17
    0
      extract_emojis.py

+ 17
- 0
extract_emojis.py 查看文件

@@ -0,0 +1,17 @@
import requests
from bs4 import BeautifulSoup

data = requests.get('https://emojipedia.org/emoji/') # type: requests.Response
soup = BeautifulSoup(data.content, 'lxml') # type: BeautifulSoup

python_file = open('emojis.py', 'w')
python_file.write('emojis="""\n')

for table_row in soup.find_all('tr'):
emoji_row = table_row.find('td')
text = emoji_row.get_text()

python_file.write(text + '\n')
python_file.write('"""')

python_file.close()

Loading…
取消
儲存