From 1c93e5430a2268f53f21b4d136138b8f9bac808b Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 18 Aug 2024 22:32:39 +0530 Subject: [PATCH] feat: scrape after scroll completion --- maxun-core/src/interpret.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index 70164f78..d7e05eee 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -384,7 +384,10 @@ export default class Interpreter extends EventEmitter { // Check if new content was loaded const currentHeight = await page.evaluate(() => document.body.scrollHeight); if (currentHeight === previousHeight) { - // No new content loaded, exit loop + // No new content loaded, scrape final results and exit loop + const finalResults = await page.evaluate((cfg) => window.scrapeList(cfg), config); + allResults = allResults.concat(finalResults); + return allResults; return allResults; } previousHeight = currentHeight;