Skip to content

Instantly share code, notes, and snippets.

@robhawkins
Created August 24, 2019 03:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robhawkins/0ca82696c886697b5a0261dd788253d4 to your computer and use it in GitHub Desktop.
Save robhawkins/0ca82696c886697b5a0261dd788253d4 to your computer and use it in GitHub Desktop.
download emojis from yaml
#!/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")
@robhawkins
Copy link
Author

Here is a script for downloading and renaming emoji icons for bulk upload elsewhere, for example slack.

Usage

python downloadPack.py packs/starwars.yaml
ls -l downloads/starwars

Using this + the neutral face emoji tools extension to bulk-upload works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment