Skip to content

Instantly share code, notes, and snippets.

@katsaii
Created January 8, 2026 23:44
Show Gist options
  • Select an option

  • Save katsaii/387a3ecd08cd423e627b450e3f1c8e25 to your computer and use it in GitHub Desktop.

Select an option

Save katsaii/387a3ecd08cd423e627b450e3f1c8e25 to your computer and use it in GitHub Desktop.
JS console command to download upscaled thumbnails of Gyazo images, bypasses the pay wall at the cost of loss of image quality.
(async () => {
const require_ = async (jsURL) => {
// we can have a little security vulnerability, as a treat!
return await fetch(jsURL).then(data => data.text()).then(eval);
};
if (!this.includedJSZip) {
this.includedJSZip = true;
await require_("https://raw.githubusercontent.com/Stuk/jszip/refs/heads/main/dist/jszip.min.js");
await require_("https://raw.githubusercontent.com/eligrey/FileSaver.js/refs/heads/master/src/FileSaver.js");
}
const thumbClass = "thumb"; // the HTML class of the thumbnail images
const pauseDuration = 3000; // how long to wait between scrolls
const pause = (ms = pauseDuration) => new Promise(res => setTimeout(res, ms));
const savedFiles = new Set;
const savedFilesZIP = new JSZip;
let savedFileCount = 0;
console.log("scrolling to top");
window.scrollTo(0, 0);
let retries = 0;
const retriesLimit = 3;
while (retries <= retriesLimit) {
await pause();
const thumbs = document.getElementsByClassName(thumbClass);
const prevSavedFileCount = savedFileCount;
for (const thumb of thumbs) {
if (savedFiles.has(thumb.src)) {
continue;
}
savedFiles.add(thumb.src);
const parentElem = thumb.parentElement.parentElement;
let imgURL = thumb.src.replace("120_w", "2048_w");
const imgExt = imgURL.split(".").pop();
let imgName = "unnamed";
if (parentElem) {
const rawImgElem = parentElem.getElementsByClassName("view-operation")[0];
if (rawImgElem) {
const fileID = rawImgElem.href.replace("https://gyazo.com/", "");
imgURL = `https://i.gyazo.com/${fileID}.${imgExt}`;
}
const metaElem = parentElem.getElementsByClassName("metadata")[0];
if (metaElem) {
imgName = metaElem.textContent.replaceAll(/[#<>:"/\\|?*]/g, "");
}
}
savedFileCount += 1;
console.log(`...downloading: ${imgName} (${imgURL})`);
savedFilesZIP.file(`c${savedFileCount} ${imgName}.${imgExt}`, fetch(imgURL).then(x => x.bytes()));
}
if (savedFileCount <= prevSavedFileCount) {
retries += 1;
console.log(`failed to download any new images, retrying ${retries}/${retriesLimit} times`);
continue;
}
console.log(`scrolling by ${window.innerHeight}px`);
window.scrollBy(0, window.innerHeight);
}
console.log(`complete! found ${savedFileCount} images`);
this.savedFilesZIP = savedFilesZIP;
savedFilesZIP.generateAsync({ type : "blob" })
.then((blob) => saveAs(blob, "gyazo-captures.zip"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment