Skip to content

add support infinite scroll, initial cookies - #3

Merged
mtrunkat merged 9 commits into
apify:masterfrom
drobnikj:master
Dec 4, 2017
Merged

mtrunkat merged 9 commits into
apify:masterfrom
drobnikj:master

Conversation

@drobnikj

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/modules/puppeteer_utils.js Outdated
*/
export const infiniteScroll = async (page, maxHeight) => {
const maybeResourceTypesInfiniteScroll = ['xhr', 'fetch', 'websocket', 'other'];
const scrollTo = (page, xpos, ypos) => page.evaluate((x, y) => window.scrollTo(x, y), xpos, ypos);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move getPageScrollInfo and scrollTo to puppeteer_utils.js . It's reusable.

Comment thread src/modules/puppeteer_utils.js Outdated
if (maybeResourceTypesInfiniteScroll.includes(msg.resourceType)) resourcesStats.finished++;
});

console.log(`Infinite scroll started (scrollTop=${scrollInfo.scrollTop}, clientHeight=${scrollInfo.clientHeight}, scrollHeight=${scrollInfo.scrollHeight}, maxHeight=${maxHeight}).`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about to put logging to function -

(scrollTop=${scrollInfo.scrollTop}, clientHeight=${scrollInfo.clientHeight}, scrollHeight=${scrollInfo.scrollHeight}, maxHeight=${maxHeight})
  • is three times here

Comment thread src/modules/puppeteer_utils.js Outdated
if (maybeResourceTypesInfiniteScroll.includes(msg.resourceType)) resourcesStats.finished++;
});

console.log(`Infinite scroll started (scrollTop=${scrollInfo.scrollTop}, clientHeight=${scrollInfo.clientHeight}, scrollHeight=${scrollInfo.scrollHeight}, maxHeight=${maxHeight}).`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use logDebug here so that it's not displayed when running in production env

@mtrunkat
mtrunkat merged commit 2094893 into apify:master Dec 4, 2017
janbuchar pushed a commit that referenced this pull request Nov 13, 2025
add support infinite scroll, initial cookies
janbuchar pushed a commit that referenced this pull request Nov 13, 2025
add support infinite scroll, initial cookies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants