chore(lucida): Add logging
This commit is contained in:
parent
7a115ad2b2
commit
b0a44f32d0
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Reference in a new issue