Last active
December 9, 2017 02:24
-
-
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
This file contains hidden or 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
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)}); |
This file contains hidden or 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
RewriteEngine On | |
RewriteBase /html | |
RewriteRule (\d+)\/(.+)\.png /discordemoji/emoji.php?n=$2&e=$1 [L] |
This file contains hidden or 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
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); | |
}); |
This file contains hidden or 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
<?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