chore: lint
This commit is contained in:
@@ -281,22 +281,22 @@ export default class Interpreter extends EventEmitter {
|
|||||||
|
|
||||||
const scrapeResults: Record<string, string>[] = await page.evaluate((s) => window.scrape(s ?? null), selector);
|
const scrapeResults: Record<string, string>[] = await page.evaluate((s) => window.scrape(s ?? null), selector);
|
||||||
await this.options.serializableCallback(scrapeResults);
|
await this.options.serializableCallback(scrapeResults);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrapeSchema: async (schema: Record<string, string>) => {
|
scrapeSchema: async (schema: Record<string, string>) => {
|
||||||
await this.ensureScriptsLoaded(page);
|
await this.ensureScriptsLoaded(page);
|
||||||
|
|
||||||
const handleLists = await Promise.all(
|
const handleLists = await Promise.all(
|
||||||
Object.values(schema).map((selector) => page.$$(selector)),
|
Object.values(schema).map((selector) => page.$$(selector)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const namedHandleLists = Object.fromEntries(
|
const namedHandleLists = Object.fromEntries(
|
||||||
Object.keys(schema).map((key, i) => [key, handleLists[i]]),
|
Object.keys(schema).map((key, i) => [key, handleLists[i]]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const scrapeResult = await page.evaluate((n) => window.scrapeSchema(n), namedHandleLists);
|
const scrapeResult = await page.evaluate((n) => window.scrapeSchema(n), namedHandleLists);
|
||||||
await this.options.serializableCallback(scrapeResult);
|
await this.options.serializableCallback(scrapeResult);
|
||||||
},
|
},
|
||||||
|
|
||||||
scroll: async (pages?: number) => {
|
scroll: async (pages?: number) => {
|
||||||
await page.evaluate(async (pagesInternal) => {
|
await page.evaluate(async (pagesInternal) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user