Skip to content

Instantly share code, notes, and snippets.

@mnmkng
Created June 22, 2022 19:34
Show Gist options
  • Save mnmkng/128cd0fe6594081ecad0bb8dbc8f7b40 to your computer and use it in GitHub Desktop.
Save mnmkng/128cd0fe6594081ecad0bb8dbc8f7b40 to your computer and use it in GitHub Desktop.
import { PlaywrightCrawler, utils } from 'crawlee';
const crawler = new PlaywrightCrawler({
browserPoolOptions: {
// preLaunchHooks: [
// (pageId, launchContext) => {
// launchContext.launchOptions.locale = 'cs-CZ'
// }
// ]
fingerprintOptions: {
fingerprintGeneratorOptions: {
locales: ['cs-CZ']
}
}
}
});
crawler.router.addDefaultHandler(async ({ request, page, enqueueLinks }) => {
const title = await page.title();
console.log(`Title of ${request.url}: ${title}`);
await page.waitForLoadState('networkidle')
await utils.puppeteer.saveSnapshot(page);
});
await crawler.addRequests(['https://browserleaks.com/javascript']);
await crawler.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment