From 1b3bfddcb153fecfa444b8bde160ff93a8e5d022 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 19 Aug 2024 02:47:41 +0530 Subject: [PATCH] feat: track pages --- maxun-core/src/interpret.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maxun-core/src/interpret.ts b/maxun-core/src/interpret.ts index f8cd8cfe..326e394e 100644 --- a/maxun-core/src/interpret.ts +++ b/maxun-core/src/interpret.ts @@ -374,6 +374,7 @@ export default class Interpreter extends EventEmitter { let previousHeight = 0; // track unique items to avoid re-scraping let scrapedItems: Set = new Set(); + let currentPage = 1 while (true) { switch (config.pagination.type) { @@ -414,6 +415,8 @@ export default class Interpreter extends EventEmitter { nextButton.click(), page.waitForNavigation({ waitUntil: 'networkidle' }) ]); + + currentPage += 1; break; case 'clickLoadMore': const loadMoreButton = await page.$(config.pagination.selector);