feat: call scrapeList based on pagination
This commit is contained in:
@@ -299,8 +299,13 @@ export default class Interpreter extends EventEmitter {
|
|||||||
|
|
||||||
scrapeList: async (config: { listSelector: string, fields: any, limit?: number, pagination: any }) => {
|
scrapeList: async (config: { listSelector: string, fields: any, limit?: number, pagination: any }) => {
|
||||||
await this.ensureScriptsLoaded(page);
|
await this.ensureScriptsLoaded(page);
|
||||||
const scrapeResults: Record<string, any>[] = await this.handlePagination(page, config);
|
if (!config.pagination) {
|
||||||
await this.options.serializableCallback(scrapeResults);
|
const scrapeResults: Record<string, any>[] = await page.evaluate((cfg) => window.scrapeList(cfg), config);
|
||||||
|
await this.options.serializableCallback(scrapeResults);
|
||||||
|
} else {
|
||||||
|
const scrapeResults: Record<string, any>[] = await this.handlePagination(page, config);
|
||||||
|
await this.options.serializableCallback(scrapeResults);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scrapeListAuto: async (config: { listSelector: string }) => {
|
scrapeListAuto: async (config: { listSelector: string }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user