From e8e6a2d9b0cb6f16a60e6fc8b365d9f8ada1866f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 20 Sep 2024 20:17:45 +0530 Subject: [PATCH] feat: remove browser based click next pagination --- maxun-core/src/browserSide/scraper.js | 41 --------------------------- 1 file changed, 41 deletions(-) diff --git a/maxun-core/src/browserSide/scraper.js b/maxun-core/src/browserSide/scraper.js index 1ea4b3b4..706e332e 100644 --- a/maxun-core/src/browserSide/scraper.js +++ b/maxun-core/src/browserSide/scraper.js @@ -164,47 +164,6 @@ async function scrollUpToLoadMore(selector, limit) { } } -async function clickNextPagination(selector, scrapedData, limit) { - // Check if the limit is already met - if (scrapedData.length >= limit) { - return false; // Return false to indicate no further action is needed - } - - // Check if a single "Next" button exists - let nextButton = document.querySelector(selector); - - if (nextButton) { - nextButton.click(); - return true; // Indicate that pagination occurred - } else { - // Handle pagination with numbers - const paginationButtons = document.querySelectorAll(selector); - let clicked = false; - - // Loop through pagination buttons to find the current active page - for (let i = 0; i < paginationButtons.length - 1; i++) { - const button = paginationButtons[i]; - if (button.classList.contains('active')) { - // Click the next button if available - const nextButtonInPagination = paginationButtons[i + 1]; - if (nextButtonInPagination) { - nextButtonInPagination.click(); - clicked = true; - break; - } - } - } - - // If no next button was clicked, we might be on the last page - if (!clicked) { - throw new Error("No more items to load or pagination has ended."); - } - - return clicked; // Indicate whether pagination occurred - } -} - - /** * Returns a "scrape" result from the current page. * @returns {Array} *Curated* array of scraped information (with sparse rows removed)