From 80558faa60f7c28e0fc2c6e88df04c00e2d994fb Mon Sep 17 00:00:00 2001 From: Lluis Date: Thu, 30 May 2024 12:57:46 +0200 Subject: [PATCH] click content advisor and refresh after screenshot --- helpers/browserApi.js | 1 + services/browser.js | 1 + 2 files changed, 2 insertions(+) diff --git a/helpers/browserApi.js b/helpers/browserApi.js index 728c49b..0f1b311 100644 --- a/helpers/browserApi.js +++ b/helpers/browserApi.js @@ -56,6 +56,7 @@ class PuppeteerApi { async removeElementsAndGetDiv() { await this.page.waitForSelector('div.persistent-player') await new Promise(r => setTimeout(r, 500)) + await this.page.click('button[data-a-target="content-classification-gate-overlay-start-watching-button"]').catch(() => {}) await this.page.$eval('div.consent-banner', el => el.remove()).catch(() => {}) await this.page.$eval('#twilight-sticky-footer-root', el => el.remove()).catch(() => {}) await this.page.$eval('button[data-a-target="content-classification-gate-overlay-start-watching-button"]', el => el.click()).catch(() => { }) diff --git a/services/browser.js b/services/browser.js index 9523f2f..bf79f2f 100644 --- a/services/browser.js +++ b/services/browser.js @@ -17,6 +17,7 @@ async function getScreenshot() { sharp(bufferImage) .resize({ width: 200 }) .toFile(`public/images/t_${name}.jpg`).catch(() => { console.error('rsize image for thumbnail')}) + this.refreshPage() } catch (error) { console.log(error) return null