feat: gracefully proceed if !adblocker
This commit is contained in:
@@ -245,10 +245,17 @@ export class RemoteBrowser {
|
|||||||
|
|
||||||
await this.setupPageEventListeners(this.currentPage);
|
await this.setupPageEventListeners(this.currentPage);
|
||||||
|
|
||||||
const blocker = await PlaywrightBlocker.fromLists(fetch, ['https://easylist.to/easylist/easylist.txt']);
|
try {
|
||||||
await blocker.enableBlockingInPage(this.currentPage);
|
const blocker = await PlaywrightBlocker.fromLists(fetch, ['https://easylist.to/easylist/easylist.txt']);
|
||||||
this.client = await this.currentPage.context().newCDPSession(this.currentPage);
|
await blocker.enableBlockingInPage(this.currentPage);
|
||||||
await blocker.disableBlockingInPage(this.currentPage);
|
this.client = await this.currentPage.context().newCDPSession(this.currentPage);
|
||||||
|
await blocker.disableBlockingInPage(this.currentPage);
|
||||||
|
console.log('Adblocker initialized');
|
||||||
|
} catch (error: any) {
|
||||||
|
console.warn('Failed to initialize adblocker, continuing without it:', error.message);
|
||||||
|
// Still need to set up the CDP session even if blocker fails
|
||||||
|
this.client = await this.currentPage.context().newCDPSession(this.currentPage);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user