feat: random device resolution & accept cookies

This commit is contained in:
2025-04-13 00:31:57 +07:00
parent 2ad2f9993e
commit cb427a9fa4
2 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,14 @@
import type { Page } from "patchright";
import logger from "../logger";
async function init(page: Page, spawnId: string = "unknown") {
const consentButton = page.locator("button[data-a-target='consent-banner-accept']");
if ((await consentButton.all()).length > 0) {
logger.debug(`[${spawnId}] Consent button found, clicking it...`);
await consentButton.click();
}
}
async function keepAlive(page: Page, spawnId: string = "unknown") {
try {
let waitTime = 0;
@ -25,4 +33,4 @@ async function keepAlive(page: Page, spawnId: string = "unknown") {
}
}
export { keepAlive };
export { init, keepAlive };