Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
fix infinite scroll
Lukáš Křivkac2d65692c39f
diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.jsindex 536b06193..0cdff4d9b 100644--- a/src/puppeteer_utils.js+++ b/src/puppeteer_utils.js@@ -494,10 +494,10 @@ export const infiniteScroll = async (page, options = {}) => {const doScroll = async () => {/* istanbul ignore next */- await page.evaluate(async () => {- const delta = document.body.scrollHeight === 0 ? SCROLL_HEIGHT_IF_ZERO : document.body.scrollHeight;+ await page.evaluate(async (scrollHeightIfZero) => {+ const delta = document.body.scrollHeight === 0 ? scrollHeightIfZero : document.body.scrollHeight;window.scrollBy(0, delta);- });+ }, SCROLL_HEIGHT_IF_ZERO);};while (!finished) {