Write a polite infinite scroll collector
Writes a script that loads an infinite scroll page step by step with limits and delays, after checking the site's terms allow it.
Task:
Write one function in [language and tool] that scrolls an infinite scroll page and collects the item titles.
Context:
The page is [page description] and each item is found with [selector or description]. I have read the terms and robots.txt and automated access to this page is allowed: [yes, and what they say].
Rules:
- Stop after [maximum items] items or [maximum scrolls] scrolls, whichever comes first.
- Pause [seconds] seconds between scrolls and stop when no new items appear twice in a row.
- Stop and report at once on a 403, 429 or CAPTCHA, without retrying around it.
- If the page offers a documented API or a paginated route, say so in a comment and prefer it.
- Say if you are unsure of a method name so I can check the current documentation.
Result:
One complete function with a comment on each limit, followed by at most 4 lines on how to run it.