Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ async function getImageLinksPlaywright(url: string): Promise<string[]> {

const maxClicks = 5;
let clickCount = 0;
let triedFinding = false;

while (clickCount < maxClicks) {
const loadMoreButton = await findLoadMoreButton(page);
Expand All @@ -143,7 +144,12 @@ async function getImageLinksPlaywright(url: string): Promise<string[]> {
}
} else {
console.log("No Load More button left to click.");
break;
if (!triedFinding) {
await page.waitForTimeout(5000);
triedFinding = true;
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry logic should continue the loop after waiting, not just set the flag. Currently, after the 5-second wait and setting triedFinding = true, the loop continues but immediately evaluates findLoadMoreButton again without any indication that the button should now be available. Consider adding continue; after line 149 to make the retry intent explicit.

Suggested change
triedFinding = true;
triedFinding = true;
continue;

Copilot uses AI. Check for mistakes.
} else {
break;
}
}
}

Expand Down