From be3f4189d09b9f1e358551f7166c7f75f934dc5c Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 9 Mar 2025 11:46:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=94=BB=E5=BB=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=9B=BE=E5=83=8F=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BB=A5=E6=AD=A3=E7=A1=AE=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=92=8C=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page/GalleryPage.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/page/GalleryPage.ts b/page/GalleryPage.ts index f02d5b3..887f7f3 100644 --- a/page/GalleryPage.ts +++ b/page/GalleryPage.ts @@ -177,10 +177,9 @@ class GalleryPage { } async #get_imagelist() { function load_image(doc: Element): Page[] { - const eles = doc.querySelectorAll("#gdt > div[class^=gdt]"); + const eles = doc.querySelectorAll("#gdt > a"); return map(eles, (e) => { - const b = e as Element; - const a = b.querySelector("a"); + const a = e as Element; if (!a) throw Error("Link not found."); const href = a.getAttribute("href"); if (!href) throw Error("Link not found."); @@ -190,14 +189,14 @@ class GalleryPage { } const token = u.token; const index = u.index; - const img = b.querySelector("img"); + const img = a.querySelector("div"); if (!img) throw Error("Image not found."); - const thumbnail = img.getAttribute("src"); + const thumbnail = img.getAttribute("style")?.match(/url\((.*)\)/i); if (!thumbnail) throw Error("Image source not found"); const name = img.getAttribute("title")?.match(/page \d+: (.*)/i) ?.at(1); if (!name) throw Error("name not found"); - return { name, token, thumbnail, index }; + return { name, token, thumbnail: thumbnail[1], index }; }); } let b = load_image(this.doc);