Skip to content

Instantly share code, notes, and snippets.

@patheticGeek
Created April 28, 2021 13:49
Show Gist options
  • Save patheticGeek/4396c08cf6a7c00f29694d76038f03e4 to your computer and use it in GitHub Desktop.
Save patheticGeek/4396c08cf6a7c00f29694d76038f03e4 to your computer and use it in GitHub Desktop.
Discord Emoji Stealer Lite
let emojis = new Set()
let images = $0.querySelectorAll('img')
function downloadPng({ url, name }) {
return new Promise(resolve => {
const xhr = new XMLHttpRequest();
xhr.onload = () => {
const file = new Blob([xhr.response], {
type: "image/png",
});
const browserUrl = window.webkitURL || window.URL;
const fileUrl = browserUrl.createObjectURL(file);
const a = document.createElement("a");
a.href = fileUrl;
a.download = name;
a.click();
browserUrl.revokeObjectURL(fileUrl);
resolve();
}
xhr.open("GET", url, true)
xhr.responseType = "blob"
xhr.send(null);
})
}
async function downloadEmojis() {
let ind = 0;
for (let obj of emojis) {
console.log(`Starting downloading ${ind} ${obj.name}`);
// wait 1 sec for each emoji and not overwhelm
// your pc/discord cdn
const waiter = new Promise((resolve) => setTimeout(resolve, 1000));
const downloader = downloadPng(obj);
await Promise.all([ waiter, downloader ]);
console.log(`Downloaded ${ind} ${obj.name}`);
ind++;
}
}
function getImages() {
const before = emojis.size;
images.forEach(img => {
const url = img.src;
const name = img.alt;
emojis.add({ url, name });
})
console.log(`Added ${emojis.size - before} emoji's`);
}
// select the parent div of a servers emojis section
// and then run addImages() and scroll down a bit and run again
// then run download() to download all of them juicy emojis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment