feat: random device resolution & accept cookies
This commit is contained in:
@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user