summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2023-02-03 02:42:59 +0100
committeremkael <emkael@tlen.pl>2023-02-03 02:42:59 +0100
commit373141ac8765c76f06c496a51b320852447c20ba (patch)
tree22bb6dabb4273171d73207e736d6b2fd8349f5fb
parent410c431d2f700848790461cad725661e2021a2ce (diff)
Porting emoji-list to Py3HEADmaster
-rw-r--r--_cron/emoji-list2
-rw-r--r--bin/emoji-list.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/_cron/emoji-list b/_cron/emoji-list
index f705d00..b8877d2 100644
--- a/_cron/emoji-list
+++ b/_cron/emoji-list
@@ -1 +1 @@
-25 15 * * * python $SITEPATH/bin/emoji-list.py
+25 15 * * * python3 $SITEPATH/bin/emoji-list.py
diff --git a/bin/emoji-list.py b/bin/emoji-list.py
index 823347d..9e17c30 100644
--- a/bin/emoji-list.py
+++ b/bin/emoji-list.py
@@ -1,23 +1,23 @@
-import json, os, urllib
+import json, os, urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
-emoji_list = json.load(urllib.urlopen(
+emoji_list = json.load(urllib.request.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('-')])
+ character = ''.join([chr(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)
-retardspeak_map = ET.fromstring(urllib.urlopen(
+stupidspeak_map = ET.fromstring(urllib.request.urlopen(
'http://slothsoft.net/getResource.php/slothsoft/unicode-mapper'
).read())
-for letter in retardspeak_map.findall('.//letter'):
+for letter in stupidspeak_map.findall('.//letter'):
if letter.attrib['target'] != letter.attrib['source']:
dictionary[letter.attrib['target']] = letter.attrib['source']
-json.dump(dictionary, file(os.path.join(
+json.dump(dictionary, open(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'../config/emoji.json'
), 'w'))