Created
August 24, 2019 03:30
-
-
Save robhawkins/0ca82696c886697b5a0261dd788253d4 to your computer and use it in GitHub Desktop.
download emojis from yaml
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 python | |
import yaml | |
import sys | |
import requests | |
import os | |
yaml_file = sys.argv[1] | |
packname = os.path.splitext(os.path.basename(yaml_file))[0] | |
odir = 'downloads/'+packname+'/' | |
os.makedirs(odir,exist_ok=True) | |
with open(yaml_file, 'r') as stream: | |
try: | |
data = yaml.safe_load(stream) | |
except yaml.YAMLError as exc: | |
print(exc) | |
for e in data['emojis']: | |
response = requests.get(e['src']) | |
ext = os.path.splitext(e['src'])[1] | |
if response.ok: | |
file = open(odir+e['name']+ext, "wb+") | |
file.write(response.content) | |
file.close() | |
else: | |
print("Failed to get the file") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a script for downloading and renaming emoji icons for bulk upload elsewhere, for example slack.
Usage
Using this + the neutral face emoji tools extension to bulk-upload works for me.