From b0a44f32d045c4d875fbb60fc512e72bc0ea6f71 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Sun, 29 Dec 2024 17:49:27 +0100 Subject: [PATCH] chore(lucida): Add logging --- src/lucida.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lucida.ts b/src/lucida.ts index 0676b24..a3bfc3a 100644 --- a/src/lucida.ts +++ b/src/lucida.ts @@ -18,9 +18,16 @@ async function lucida(album: URL, timeout: number, context: BrowserContext): Pro // Check 'Hide my download from recently downloaded' checkbox await page.check('input[id="hide-from-ticker"]'); + // Parse info + const albumName: string = (await page.locator('h1[class="svelte-6pt9ji"]').last().innerText()).trim(); + const trackCount: string = (await page.locator('h3[class="svelte-6pt9ji"]').first().innerText()).trim(); + // Start download await page.getByText('download full album').click(); + console.log(`Downloading ${albumName} (${trackCount}) from ${album.href}...`); + + page.on('download', download => download.path().then(console.log)); const downloadPromise: Promise = page.waitForEvent('download', { timeout: timeout }); const download: Download = await downloadPromise;