From 5941988ec6fb5359f82fd116f2c48b4e35830929 Mon Sep 17 00:00:00 2001 From: jzitnik-dev Date: Thu, 7 Aug 2025 00:29:59 +0200 Subject: [PATCH] feat: Idk --- scrape/scraper.js | 21 ++++++++++++++++++--- server.js | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/scrape/scraper.js b/scrape/scraper.js index 5f7d8ee..63092f1 100644 --- a/scrape/scraper.js +++ b/scrape/scraper.js @@ -20,8 +20,8 @@ async function clearDownloadsFolder() { (async () => { const browser = await puppeteer.launch({ - headless: 'new', - //headless: false, + //headless: 'new', + headless: false, userDataDir: VOLUME_PATH, args: ['--no-sandbox', '--disable-setuid-sandbox'] }); @@ -48,7 +48,22 @@ async function clearDownloadsFolder() { await page.keyboard.press('Enter'); await new Promise(r => setTimeout(r, 2000)); - await page.waitForSelector('input[type="password"]', { timeout: 10000 }); + try { + await page.waitForSelector('div[role="button"]', { timeout: 5000 }); + const signInButtons = await page.$$('div[role="button"]'); + for (const btn of signInButtons) { + const text = await page.evaluate(el => el.innerText, btn); + if (text && text.includes('with password')) { + console.log('Clicking "Sign in with password"...'); + await btn.click(); + break; + } + } + } catch (err) { + console.log('"Sign in with password" button not found, continuing...'); + } + + await page.waitForSelector('input[type="password"]', { timeout: 100000 }); await page.type('input[type="password"]', PASSWORD, { delay: 50 }); await page.keyboard.press('Enter'); diff --git a/server.js b/server.js index b266d35..dbbdeea 100644 --- a/server.js +++ b/server.js @@ -3,7 +3,7 @@ const path = require("path"); const app = express(); const fs = require("fs/promises"); -const PORT = 3000; +const PORT = process.env.PORT || 3000; app.get('/', (_, res) => { res.sendFile(path.join(__dirname, "db", "current.json"));