chore(lucida): Add logging

This commit is contained in:
Tibo De Peuter 2024-12-29 17:49:27 +01:00
parent 7a115ad2b2
commit b0a44f32d0
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2

View file

@ -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<Download> = page.waitForEvent('download', { timeout: timeout });
const download: Download = await downloadPromise;