fix: -rm bypassCSP
This commit is contained in:
@@ -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<string, string>[] = 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<string, string>) => {
|
||||
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(() => !<any>window.scrape)) {
|
||||
// page.context().addInitScript({ path: path.join(__dirname, 'browserSide', 'scraper.js') });
|
||||
// }
|
||||
|
||||
// await page.context({
|
||||
// bypassCSP: true,
|
||||
// })
|
||||
|
||||
this.stopper = () => {
|
||||
this.stopper = null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user