Untitled
unknown
javascript
4 years ago
887 B
7
Indexable
const Apify = require('apify'); const { utils: { log } } = Apify; Apify.main(async () => { const { username, password } = await Apify.getInput(); const requestQueue = await Apify.openRequestQueue(); await requestQueue.addRequest({ url: 'https://www.apify.com/' }); const crawler = new Apify.PuppeteerCrawler({ requestQueue, launchContext: { // Chrome with stealth should work for most websites. // If it doesn't, feel free to remove this. useChrome: true }, handlePageFunction: async ({request, page}) => { const { url, userData: { label } } = request; await page.screenshot({ path: 'screenshot.png' }); log.info('Page opened.', { label, url }); }, }); log.info('Starting the crawl.'); await crawler.run(); log.info('Crawl finished.'); });
Editor is loading...