asyncio.Semaphore (Python) and a worker pool (Node.js)
Ask your AI agent
With the Zenrows MCP server connected to Claude, Cursor or any MCP client, paste this prompt. Your agent picks the right Zenrows tools and settings on its own.Scrape pages in parallel
Each task connects, scrapes one page and closes its browser.MAX_SESSIONS sets how many run together, matched to your plan’s concurrency.
return_exceptions=True in Python and the try/catch in each Node.js worker record a failure and let the other sessions carry on. Retry the failed URLs in a second pass.
Example output
Customize it
Troubleshooting
- Some connections are refused while others run: more sessions are open than your plan’s concurrency. Lower
MAX_SESSIONS, and make sure every task closes its browser infinally. - The job slows down as it runs: sessions from earlier runs are still open. Close every browser explicitly, and set a short
session_ttlsuch as2mso forgotten sessions end on their own. - Results come back in a different order: workers finish at different times. Key results by URL, as the examples do.
- One page keeps failing: the page needs more time or a different country. Retry it alone with
wait_until="load"or aproxy_country.
Related recipes
Connect Playwright or Puppeteer to Zenrows Browser
The connection URL and its country, region and lifetime options.
Scroll and paginate to collect every item
Collect full listings, then fan out to their detail pages.
Scrape a list of URLs
Send thousands of URLs as one Batch job.
Fetch first, open a Browser when a task needs interaction
Use Fetch first and open a browser for the pages that need it.