From b70086cc996c98917fb84e957b21585b9a82337a Mon Sep 17 00:00:00 2001 From: jooooock Date: Tue, 3 Dec 2024 09:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #50 --- utils/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/index.ts b/utils/index.ts index db39bbd..74b21a2 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -543,7 +543,7 @@ export async function packHTMLAssets(html: string, title: string, zip?: JSZip) { // 下载所有的图片 const imgDownloadFn = async (img: HTMLImageElement, proxy: string) => { - const url = img.src || img.dataset.src! + const url = img.getAttribute('src') || img.getAttribute('data-src') if (!url) { return 0 } @@ -558,7 +558,7 @@ export async function packHTMLAssets(html: string, title: string, zip?: JSZip) { return imgData.size } - const imgs = Array.from($jsArticleContent.querySelectorAll('img')).filter(img => img.getAttribute('src')?.trim()) + const imgs = $jsArticleContent.querySelectorAll('img') if (imgs.length > 0) { await pool.downloads([...imgs], imgDownloadFn) }