//...
const proxyConfiguration = await Apify.createProxyConfiguration();
const launchContext = {
useChrome: true,
stealth: true,
launchOptions: {
headless: true,
},
};
const crawler = new Apify.PuppeteerCrawler({
requestList,
requestQueue,
proxyConfiguration,
launchContext: launchContext as any,
maxRequestRetries: 5,
handlePageTimeoutSecs: 180,
navigationTimeoutSecs: 180,
async handlePageFunction({ page, request }): Promise<void> {
await utils.puppeteer.saveSnapshot(page, { key: 'beforescrap', saveHtml: false });
const cheerio = load(await page.content());
const html = cheerio.html();
await Apify.setValue('htmlstring', html, { contentType: 'text/html' });
await page.waitForSelector('a[data-testid="search-listing-title"]');
//...
//...
const proxyConfiguration = await Apify.createProxyConfiguration();
const launchContext = {
useChrome: true,
stealth: true,
launchOptions: {
headless: true,
},
};
const crawler = new Apify.PuppeteerCrawler({
requestList,
requestQueue,
proxyConfiguration,
launchContext: launchContext as any,
maxRequestRetries: 5,
handlePageTimeoutSecs: 180,
navigationTimeoutSecs: 180,
async handlePageFunction({ page, request }): Promise<void> {
await utils.puppeteer.saveSnapshot(page, { key: 'beforescrap', saveHtml: false });
const cheerio = load(await page.content());
const html = cheerio.html();
await Apify.setValue('htmlstring', html, { contentType: 'text/html' });
await page.waitForSelector('a[data-testid="search-listing-title"]');
//...