Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Apify = require('apify');
- Apify.main(async () => {
- const requestQueue = await Apify.openRequestQueue();
- await requestQueue.addRequest({ url: 'http://localhost:5007/'});
- const pseudoUrls = [new Apify.PseudoUrl('http://localhost:3000/[.*]')];
- 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.puppeteer.enqueueLinks({ page, selector: 'a', pseudoUrls, requestQueue });
- }
- });
- await crawler.run();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement