Last active
June 24, 2020 15:27
-
-
Save pspaul/b35639cf5b10dc679003b53f10d9c9bc to your computer and use it in GitHub Desktop.
Slack custom emoji download script generator
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
// Usage: | |
// 1. Open Slack | |
// 2. Open the emoji picker | |
// 3. Scroll to the custom emojis | |
// 4. Open the developer tools (press F12) | |
// 5. Paste and run this script | |
// 6. Save the output as yoink.sh | |
// 7. Execute it | |
// 8. Wait a moment | |
// 9. Enjoy all your downloaded custom emojis! | |
function createDownloadScript() { | |
const emojiButtons = Array.from(document.querySelectorAll('button[data-qa=emoji_list_item]')); | |
const emojis = emojiButtons.map(btn => { | |
const url = btn.querySelector('img').src; | |
return { | |
url, | |
name: btn.dataset.name, | |
extension: url.split('.').reverse()[0], | |
}; | |
}); | |
const customEmojis = emojis.filter(emoji => emoji.url.startsWith('https://emoji.slack-edge.com')); | |
const commands = customEmojis.map(emoji => `wget "${emoji.url}" -O "${emoji.name}.${emoji.extension}"`); | |
const script = `#!/bin/sh\necho "Downloading ${commands.length} emojis..."\n${commands.join('\n')}`; | |
return script; | |
} | |
console.log(createDownloadScript()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
❤️