GM_archiveImages

打包下载图片

Dette script bør ikke installeres direkte. Det er et bibliotek, som andre scripts kan inkludere med metadirektivet // @require https://update.greasyfork.org/scripts/565289/1749527/GM_archiveImages.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Skaber
ssnangua
Version
0.0.1.20260205211748
Oprettet
05.02.2026
Opdateret
05.02.2026
Size
2,07 kB
Licens
N/A

需要引入以下依赖:GM_pLimitGM_requestJSZipFileSaver

// @require      https://update.greasyfork.org/scripts/565266/1749341/GM_pLimit.js
// @require      https://update.greasyfork.org/scripts/565272/1749374/GM_request.js
// @require      https://update.greasyfork.org/scripts/565290/1749444/JSZip-v391.js
// @require      https://update.greasyfork.org/scripts/565291/1749445/FileSaver-205.js
// @grant        GM_xmlhttpRequest

使用:

GM_archiveImages({
  images: [
    { name: "01.jpg", url: "https://..." },
    { name: "02.jpg", url: "https://..." },
  ],
  zip: "test.zip",
  concurrency: 10,
  maxRetries: 5,
  onload({ loaded, total }) {
    console.log(`下载图片:${loaded}/${total}`);
  },
  onretry({ url, currentRetry, maxRetries }) {
    console.warn(`下载失败,重试 ${currentRetry}/${maxRetries}:${url}`);
  },
  onerror({ url }) {
    console.warn(`下载失败:${url}`);
  },
  onloaded() {
    console.log("下载完成,开始打包…");
  },
  onarchive(percent) {
    console.log(`正在打包:${percent.toFixed(2)}%`);
  },
  oncomplete() {
    console.log("完成!");
  },
});