Skip to content

Instantly share code, notes, and snippets.

@aminmarashi
Created April 28, 2021 02:46
Show Gist options
  • Save aminmarashi/b17253f0fcbf2330ff23a23b977eba5d to your computer and use it in GitHub Desktop.
Save aminmarashi/b17253f0fcbf2330ff23a23b977eba5d to your computer and use it in GitHub Desktop.
Download custom Slack emojis
/*
* Go to: https://[your workspace].slack.com/customize/emoji
* And open console, then paste the code:
* The loop will stop once it reaches the end of list of emojis
* then it prints the object containing the emojis, you can
* access the object in your console too, it is called "out"
*/
count = 0;
out = {};
seen = 0;
scroller = document.querySelector('.c-scrollbar__hider');
interval = setInterval(() => {
scroller.scroll(0, (count++) * 1000);
Array.from(document.querySelectorAll('img.p-customize_emoji_list__image')).forEach((e, i) => {
ext = e.src.match(/\.(\w+)$/)[1];
out[e.alt] = { name: e.alt, ext, src: e.src };
});
if (count * 1000 > scroller.scrollHeight) {
console.log(out);
clearInterval(interval);
}
}, 2000);
@aminmarashi
Copy link
Author

aminmarashi commented Apr 28, 2021

Then you can download those in a terminal or however you like it, for example to generate a list of wget commands using the out object:

Object.keys(out).forEach(k => 
    console.log('wget %s -O %s.%s', out[k].src, out[k].name, out[k].ext)
)

Or using curl:

Object.keys(out).forEach(k => 
    console.log('curl -s %s -o %s.%s', out[k].src, out[k].name, out[k].ext)
)

Simply copy-paste the output to your terminal and execute the commands.

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