Last active
February 24, 2017 06:02
-
-
Save drillbits/148001a64dd186921c5ad6221e322881 to your computer and use it in GitHub Desktop.
download slack emoji
This file contains 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 python3.6 | |
from datetime import datetime | |
import json | |
import os | |
import sys | |
import urllib.request | |
if len(sys.argv) < 2: | |
print(f"usage: {sys.argv[0]} filelist.json") | |
sys.exit(1) | |
filelist = sys.argv[1] | |
if len(sys.argv) < 3: | |
d = os.path.join(os.getcwd(), datetime.now().strftime('%Y%m%d%H%M%S')) | |
else: | |
d = sys.argv[2] | |
os.makedirs(d, exist_ok=True) | |
with open(filelist) as fp: | |
files = json.load(fp) | |
for name, url in files.items(): | |
_, ext = os.path.splitext(url) | |
filename = os.path.join(d, f'{name}{ext}') | |
if os.path.exists(filename): | |
print(f"{filename} already exists") | |
else: | |
print(f"downloading {url} as {filename} ...") | |
urllib.request.urlretrieve(url, filename) |
This file contains 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
// https://{team}.slack.com/customize/emoji | |
var obj = {}; | |
document.querySelectorAll('.emoji_row').forEach((x) => { | |
var url = x.querySelector('span').getAttribute('data-original'); | |
var name = x.querySelectorAll('td')[1].innerHTML.trim().replace(':','').replace(':',''); | |
obj[name] = url | |
}); | |
console.log(JSON.stringify(obj)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment