-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wase.js
29 lines (23 loc) · 896 Bytes
/
wase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// The selector of the image object for the sticker. This changes every now and then, so you'll probably have to change this.
var stickerSelector = "._1guNH";
var filenamePrefix = new Date().getTime();
var urls = [];
var duplicates = 0;
var uniques = 0;
Array.from(document.querySelectorAll(stickerSelector)).forEach(sticker => {
if (sticker.src === undefined) return;
if (urls.indexOf(sticker.src) !== -1) return duplicates++;
uniques++;
download(filenamePrefix + "-" + uniques, sticker.src);
console.log("Now downloading sticker #" + uniques + ": " + sticker.src);
urls.push(sticker.src);
});
function download(filename, link) {
var element = document.createElement("a");
element.setAttribute("href", link);
element.setAttribute("download", filename);
element.style.display = "none";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}