From 9bcba4caaa94d2cc8c8f6594e634e68547bcbbbe Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Wed, 1 Jan 2025 19:22:39 +0100 Subject: [PATCH] fix(booklet): Close pages when no goodie --- src/lucida.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/lucida.ts b/src/lucida.ts index 82c9a8c..ca77d94 100644 --- a/src/lucida.ts +++ b/src/lucida.ts @@ -21,7 +21,7 @@ export async function lucida(album: URL, baseTimeout: number, context: BrowserCo const page: Page = await openAlbum(album, context); // Check 'Hide my download from recently downloaded' checkbox - await page.locator('input[id="hide-from-recent"]').first().setChecked(true); + await page.locator('input[id="hide-from-ticker"]').first().setChecked(true); // Parse info const albumName: string = (await page.locator('h1[class="svelte-6pt9ji"]').last().innerText()).trim(); @@ -81,13 +81,16 @@ async function booklet(album: URL, context: BrowserContext): Promise 0) { - console.log(await link.innerHTML()); - } else { + + if (0 <= linkCount) { console.log('No goodies link found'); + await page.close(); return null; } + console.log(`Found goodies: ${await link.innerHTML()}`) + let result: File | null = null; + try { // Go to the goodies link await link.dispatchEvent('click'); @@ -97,13 +100,13 @@ async function booklet(album: URL, context: BrowserContext): Promise