From 92db9e5b93249f67c0a84576a033497a163a2ca4 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 3 Aug 2024 02:20:16 +0530 Subject: [PATCH] fix: -rm bypassCSP --- maxun-core/src/interpret.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index 00fa4aa7..bbf930c4 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -278,13 +278,6 @@ export default class Interpreter extends EventEmitter { }, scrape: async (selector?: string) => { await this.ensureScriptsLoaded(page); - // Check if 'scrape' function is available in the page context - // const isScrapeAvailable = await page.evaluate(() => typeof window.scrape === 'function'); - - // if (!isScrapeAvailable) { - // // Inject the script that defines the 'scrape' function - // await page.addScriptTag({ path: path.join(__dirname, 'browserSide', 'scraper.js') }); - // } const scrapeResults: Record[] = await page.evaluate((s) => window.scrape(s ?? null), selector); await this.options.serializableCallback(scrapeResults); @@ -292,13 +285,6 @@ export default class Interpreter extends EventEmitter { scrapeSchema: async (schema: Record) => { await this.ensureScriptsLoaded(page); - // Check if 'scrapeSchema' function is available in the page context - // const isScrapeSchemaAvailable = await page.evaluate(() => typeof window.scrapeSchema === 'function'); - - // if (!isScrapeSchemaAvailable) { - // // Inject the script that defines the 'scrapeSchema' function - // await page.addScriptTag({ path: path.join(__dirname, 'browserSide', 'scraper.js') }); - // } const handleLists = await Promise.all( Object.values(schema).map((selector) => page.$$(selector)), @@ -457,15 +443,6 @@ export default class Interpreter extends EventEmitter { await this.ensureScriptsLoaded(page); - // @ts-ignore - // if (await page.evaluate(() => !window.scrape)) { - // page.context().addInitScript({ path: path.join(__dirname, 'browserSide', 'scraper.js') }); - // } - - // await page.context({ - // bypassCSP: true, - // }) - this.stopper = () => { this.stopper = null; };