From 8121d623247089f9dec31feaff729447fa99f7fb Mon Sep 17 00:00:00 2001 From: Yanlong Wang Date: Wed, 12 Mar 2025 18:15:06 +0800 Subject: [PATCH] fix: custom script may listen to mutationIdle --- src/dto/crawler-options.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dto/crawler-options.ts b/src/dto/crawler-options.ts index 9d774fb..55bd64d 100644 --- a/src/dto/crawler-options.ts +++ b/src/dto/crawler-options.ts @@ -619,9 +619,6 @@ export class CrawlerOptions extends AutoCastable { if ((this.respondWith.includes('vlm') || this.respondWith.includes('screenshot')) && !snapshot.screenshot) { return false; } - if (this.respondTiming === RESPOND_TIMING.MUTATION_IDLE && snapshot.lastMutationIdle) { - return true; - } if (this.respondTiming === RESPOND_TIMING.RESOURCE_IDLE && snapshot.lastContentResourceLoaded) { const now = Date.now(); if ((snapshot.lastContentResourceLoaded + 500) < now) { @@ -629,11 +626,14 @@ export class CrawlerOptions extends AutoCastable { } } + if (this.injectFrameScript?.length || this.injectPageScript?.length) { + return false; + } if (this.respondTiming === RESPOND_TIMING.NETWORK_IDLE) { return false; } - if (this.injectFrameScript?.length || this.injectPageScript?.length) { - return false; + if (this.respondTiming === RESPOND_TIMING.MUTATION_IDLE && snapshot.lastMutationIdle) { + return true; } if (this.respondWith.includes('lm')) { return false;