GM_archiveImages

打包下载图片

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/565289/1749527/GM_archiveImages.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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!)

Autor
ssnangua
Version
0.0.1.20260205211748
Erstellt am
05.02.2026
Letzte Aktualisierung
05.02.2026
Größe
2,07 KB
Lizenz
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("完成!");
  },
});