Skip to main content
This is documentation for SDK for JavaScript | Apify Documentation 2.3, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.4).
Version: 2.3

Puppeteer recursive crawl

Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.

To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.

const Apify = require('apify');

Apify.main(async () => {
const requestQueue = await Apify.openRequestQueue();
await requestQueue.addRequest({ url: 'https://www.iana.org/' });

const crawler = new Apify.PuppeteerCrawler({
requestQueue,
handlePageFunction: async ({ request, page }) => {
const title = await page.title();
console.log(`Title of ${request.url}: ${title}`);
await Apify.utils.enqueueLinks({
page,
requestQueue,
pseudoUrls: ['https://www.iana.org/[.*]'],
});
},
maxRequestsPerCrawl: 10,
});

await crawler.run();
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.