Skip to content

Instantly share code, notes, and snippets.

@Vazkii
Last active December 9, 2017 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Vazkii/70908f8d7d5db45585619a07dfeb3eba to your computer and use it in GitHub Desktop.
Save Vazkii/70908f8d7d5db45585619a07dfeb3eba to your computer and use it in GitHub Desktop.
Discord emoji downloader. To use: be an admin on a server, go to the Emoji section of the settings, and run the scriptlet
javascript:function download(o){var e=document.createElement("a");e.href=o,e.download=o,e.click()}function downloadEmoji(o){const e=/url\(\"https:\/\/cdn.discordapp.com\/emojis\/(\d+)\.png\"\)/;var r=o.querySelectorAll(".emoji-image"),t=getComputedStyle(r[0])["background-image"];t=t.replace(e,"$1");var l=o.querySelectorAll(".position-relative > .emoji-alias-placeholder"),a=l[0].textContent;download("https://vazkii.us/discordemoji/"+t+"/"+a+".png")}var rows=document.querySelectorAll(".emoji-row");Array.prototype.forEach.call(rows,function(o,e){downloadEmoji(o)});
RewriteEngine On
RewriteBase /html
RewriteRule (\d+)\/(.+)\.png /discordemoji/emoji.php?n=$2&e=$1 [L]
function download(url) {
var a = document.createElement("a");
a.href = url;
a.download = url;
a.click();
}
function downloadEmoji(elm) {
const pattern = /url\(\"https:\/\/cdn.discordapp.com\/emojis\/(\d+)\.png\"\)/;
var image = elm.querySelectorAll('.emoji-image');
var url = getComputedStyle(image[0])['background-image'];
url = url.replace(pattern, '$1');
var alias = elm.querySelectorAll('.position-relative > .emoji-alias-placeholder');
var name = alias[0].textContent;
download('https://vazkii.us/discordemoji/' + url + '/' + name + '.png');
}
var rows = document.querySelectorAll('.emoji-row');
Array.prototype.forEach.call(rows, function(elm, i){
downloadEmoji(elm);
});
<?php
header('Content-Type: image/png');
if($_GET && $_GET['e']) {
if($_GET['n']) {
$name = $_GET['n'];
header("Content-Disposition: filename='$name.png'");
}
$emoji = $_GET['e'];
$url = "https://cdn.discordapp.com/emojis/$emoji.png";
echo(file_get_contents($url));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment