From a7672d0430385d51e09e8abe027a5d636e69c03a Mon Sep 17 00:00:00 2001 From: kurihada Date: Tue, 3 Mar 2026 12:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=B1=BB=E5=9E=8B=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=EF=BC=9A=E8=A1=A5=E5=85=85DOM=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=BA=93=E5=B9=B6=E6=B6=88=E9=99=A4feed-detail=E4=B8=A5?= =?UTF-8?q?=E6=A0=BC=E6=A8=A1=E5=BC=8F=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/xiaohongshu/feed-detail.ts | 4 +++- tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platforms/xiaohongshu/feed-detail.ts b/src/platforms/xiaohongshu/feed-detail.ts index 1a29245..ba0b1b2 100644 --- a/src/platforms/xiaohongshu/feed-detail.ts +++ b/src/platforms/xiaohongshu/feed-detail.ts @@ -297,7 +297,9 @@ export async function getSubComments( const parentIndex = await page.evaluate((cid: string) => { const parents = document.querySelectorAll('.parent-comment'); for (let i = 0; i < parents.length; i++) { - const item = parents[i].querySelector('.comment-item'); + const parent = parents.item(i); + if (!parent) continue; + const item = parent.querySelector('.comment-item'); if (!item) continue; const id = item.getAttribute('id')?.replace(/^comment-/, '') ?? diff --git a/tsconfig.json b/tsconfig.json index ad70696..5f2a5e7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", - "lib": ["ES2022"], + "lib": ["ES2022", "DOM", "DOM.Iterable"], "outDir": "dist", "rootDir": "src", "strict": true,