diff --git a/package.json b/package.json index 62f7de4..c45e399 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbb-video-scraper", - "version": "1.0.1", + "version": "1.0.2", "description": "This is a scraper written in Node.js and using Puppeteer that gets the videos served by BBB services", "main": "bundled/index.js", "types": "bundled/index.d.ts", diff --git a/source/utils/scraper.ts b/source/utils/scraper.ts index d2c4e2b..25d6077 100644 --- a/source/utils/scraper.ts +++ b/source/utils/scraper.ts @@ -78,6 +78,9 @@ export class BBBVideoScraper { await page.goto(url, { waitUntil: 'networkidle0' }); if (scrapingOptions.duration === null) { + logger.debug('Waiting for selector of video duration'); + await page.waitForSelector('.vjs-remaining-time-display'); + logger.debug('Getting the total time of the video'); const durationText = await page.$eval('.vjs-remaining-time-display', el => { return el.innerHTML; @@ -85,6 +88,9 @@ export class BBBVideoScraper { scrapingOptions.duration = this.handleDurationText(durationText); } + logger.debug('Waiting for selector of play button'); + await page.waitForSelector('.vjs-big-play-button'); + logger.debug('Clicking play on the video'); await page.click('.vjs-big-play-button');