import { PuppeteerCrawler } from 'crawlee';
import { router } from './routes.js';
const startUrls = ['https://crawlee.dev'];
const crawler = new PuppeteerCrawler({
requestHandler: router,
launchContext: {
launchOptions: {
headless: false,
args: ['--proxy-server=http://gate.smartproxy.com:7000'],
},
},
preNavigationHooks: [
async ({ request, page }, gotoOptions) => {
await page.authenticate({ username: 'MyUserName', password: 'MyPassword' })
},
],
});
await crawler.run(startUrls);
import { PuppeteerCrawler } from 'crawlee';
import { router } from './routes.js';
const startUrls = ['https://crawlee.dev'];
const crawler = new PuppeteerCrawler({
requestHandler: router,
launchContext: {
launchOptions: {
headless: false,
args: ['--proxy-server=http://gate.smartproxy.com:7000'],
},
},
preNavigationHooks: [
async ({ request, page }, gotoOptions) => {
await page.authenticate({ username: 'MyUserName', password: 'MyPassword' })
},
],
});
await crawler.run(startUrls);