From 20c66e489868cdff236b6de05a2cb7eb265ec6a8 Mon Sep 17 00:00:00 2001 From: Perry Zhu Date: Sat, 1 Nov 2025 17:04:56 -0700 Subject: [PATCH] fix: multi round trying --- scripts/src/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/src/main.ts b/scripts/src/main.ts index 8860579..f7507ab 100644 --- a/scripts/src/main.ts +++ b/scripts/src/main.ts @@ -124,6 +124,7 @@ async function getImageLinksPlaywright(url: string): Promise { const maxClicks = 5; let clickCount = 0; + let triedFinding = false; while (clickCount < maxClicks) { const loadMoreButton = await findLoadMoreButton(page); @@ -143,7 +144,12 @@ async function getImageLinksPlaywright(url: string): Promise { } } else { console.log("No Load More button left to click."); - break; + if (!triedFinding) { + await page.waitForTimeout(5000); + triedFinding = true; + } else { + break; + } } }