Add cookie in a special request

I want to add cookie to special ajax url in pupperties: page.on('request', async (req) => { await req.continue(); // if you don't call this, it will hang indefinitely }); How to add?
3 Replies
ambitious-aqua
ambitious-aqua3y ago
import { PuppeteerCrawler } from 'crawlee';

const crawler = new PuppeteerCrawler({
preNavigationHooks: [
async ({ page }) => {
page.on('request', async (req) => {
req.continue({ headers: { Cookie: 'abc' } });
});
},
],
});
import { PuppeteerCrawler } from 'crawlee';

const crawler = new PuppeteerCrawler({
preNavigationHooks: [
async ({ page }) => {
page.on('request', async (req) => {
req.continue({ headers: { Cookie: 'abc' } });
});
},
],
});
conventional-tan
conventional-tanOP3y ago
Thank you
ambitious-aqua
ambitious-aqua3y ago
Glad it worked out!

Did you find this page helpful?