Skip to content

Instantly share code, notes, and snippets.

@AKASGaming
Created January 4, 2025 16:33
Show Gist options
  • Save AKASGaming/bee0d4261ad8e707653dd33becec6c71 to your computer and use it in GitHub Desktop.
Save AKASGaming/bee0d4261ad8e707653dd33becec6c71 to your computer and use it in GitHub Desktop.
Exports emojis from the Discord Developer Portal that are uploaded to your bot
// Paste the following code into Chrome's Developer Tools (Ctrl + Shift + I)
async function collectAllEmojis() {
let allEmojis = [];
async function scrapeCurrentPage() {
let emojis = Array.from(document.querySelectorAll('.rowWrapper-2RxnWO')).map(emoji => {
const nameInput = emoji.querySelector('.inputMini-Un2tP4');
const name = nameInput ? nameInput.value : 'No name found'; // Ensure capturing value
const idElement = emoji.querySelector('.cellId--lByq3');
const id = idElement ? idElement.textContent : 'No ID found'; // Ensure capturing text
return { name, id };
});
allEmojis = allEmojis.concat(emojis);
let nextButton = document.querySelector('.pageButtonNext-2_bbdk'); // Correct selector required
if (nextButton && !nextButton.classList.contains('disabled-29cfPA')) {
nextButton.click();
await new Promise(resolve => setTimeout(resolve, 1000)); // Adjust time if necessary
await scrapeCurrentPage();
}
}
await scrapeCurrentPage();
// Function to convert data to CSV
function convertToCSV(arr) {
const array = [Object.keys(arr[0])].concat(arr);
return array.map(it => {
return Object.values(it).map(value => `"${value}"`).join(','); // Handling data to ensure proper CSV formatting
}).join('\n');
}
// Create and download the CSV file
function downloadCSV(data) {
const csvData = convertToCSV(data);
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("download", "emoji_data.csv");
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
console.log("Collected Emojis:", allEmojis); // Debugging line to inspect collected data before download
downloadCSV(allEmojis);
}
collectAllEmojis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment