Skip to content

Instantly share code, notes, and snippets.

@qls0ulp
Forked from lmarkus/README.MD
Created December 13, 2019 09:45
Show Gist options
  • Save qls0ulp/4f67bdc17be677e7b96841d23e14a52a to your computer and use it in GitHub Desktop.
Save qls0ulp/4f67bdc17be677e7b96841d23e14a52a to your computer and use it in GitHub Desktop.
Extracting / Exporting custom emoji from Slack
#!/usr/bin/env bash
# Use:
# Make this file executable, and feed it the results from the Slack emoji URL dump. Files will be downloaded to `output`
# chmod +x download.sh
# ./download.sh emojiURLs.txt
mkdir -p output;
while read -r line || [[ -n "$line" ]]; do
parts=($line)
url=${parts[1]}
name=${parts[0]}
extension=${url##*.}
echo "Downloading ${name}"
curl -s -o "output/${name}.${extension}" "${url}"
done < "$1"
// Login to your team through the browser. Run this on the browsers dev tools javascript console
var url, name, emoji = [];
$('#emoji_ul_slack span') // This is the emoji selector's Custom section.
.each(function () {
// Extract the name
name = $(this)
.html()
.replace(/:/g, ''); // without the enclosing colons.
// Extract the url from the background-image property.
url = $(this)
.css('background-image')
.replace(/.*["'](.*)['"].*/, '$1'); // Remove the`url("` and `")` portions.
// Dump to console, then copy and paste the results into a file (eg: emojiURLs.txt).
console.log(name,url)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment