-
-
Save dogeared/f8af0c03d96f75c8215731a29faf172c to your computer and use it in GitHub Desktop.
| This builds off the excellent work of @lmarkus. | |
| The scripts below can be used in conjunction with the Slack Emoji Tools Google Chrome extension to export emojis from | |
| one Slack team and import into another team. | |
| Original work here: https://gist.github.com/lmarkus/8722f56baf8c47045621 |
| // Login to your team through the browser. | |
| // Go to: https://<team name>.slack.com/customize/emoji | |
| // Run this on the browser's dev tools javascript console | |
| var emojis = $('.emoji_row'); | |
| var numEmojis = emojis.size(); | |
| var pre = document.createElement('pre'); | |
| pre.append('[\n'); | |
| emojis.each(function (index) { | |
| var url = $(this).find('td:nth-child(1) span').attr('data-original'); | |
| var extension = url.substring(url.lastIndexOf('.')); | |
| var name = $(this).find('td:nth-child(2)').html().replace(/:|\s/g, ''); | |
| pre.append(JSON.stringify({name: name, extension: extension, url: url})); | |
| if (index == (numEmojis-1)) { | |
| pre.append('\n]'); | |
| } else { | |
| pre.append(',\n'); | |
| } | |
| }); | |
| $('body').append(pre); | |
| // Now, at the bottom of the page you'll see the json representation of all the emoji data | |
| // copy and paste the json into a file and use with 02_download.sh |
| #!/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 | |
| # | |
| # Note: This depends on the jq utility for parsing json from the command line - https://stedolan.github.io/jq/ | |
| mkdir -p output; | |
| jq -r '.[] | "curl -s -o \"output/\(.name)\(.extension)\" \"\(.url)\""' $1 | \ | |
| while read -r line; do eval "$line"; done | |
| # You can now drag and drop all the emoji files in the output folder to the Buld Emoji Uploader space that you'll see on | |
| # the https://<team>.slack.com/customize/emoji page if you've installed the chrome extension | |
| # https://chrome.google.com/webstore/detail/slack-emoji-tools/anchoacphlfbdomdlomnbbfhcmcdmjej |
Thanks for this!
For the last line of step 1 I prefer $('body').empty().append(pre) which makes it easier to select-all and copy the JSON.
This is awesome!
I actually forgot I did this work. I needed to extract some emoji, and started googling around to see if anyone had done it. Thanks for the improvements ❤️ !
this is all broken. slack switched to using virtualized lists for the emoji, so someone has to write something to trigger scrolling through the emoji list, & to grab each screen full of results. these old techniques of just running querySelectorAll & compiling the results is not going to work since most of the emoji are not in the DOM at any given time.
another day where i think virtualized list components are the worst bloody thing. you really fucked up the traditional web page, mangled it real good, react-virtualized. :(
Thanks a lot!
My version of this gist that solves the issue @mfowlewebs brought up
UPDATE for 2019:
Hi folks... Author of the original gist here.
There's a much easier way to get the emoji list. I've updated the original gist, and added a Readme with the new approach.
( https://gist.github.com/lmarkus/8722f56baf8c47045621 )
Thanks to all the folks that have contributed to enhancing this solution over the years. ❤️ OpenSource!
Enjoy your emoji, and give me a follow on twitter @lennymarkus
Some really rough .ps1 code for step 02. Shove the json in "emojis.json", and paste in a path name: