Intercept and modify requests
Block by resource type
await page.setRequestInterception(true);
page.on('request', req => {
if (['image', 'media', 'font'].includes(req.resourceType())) {
req.abort();
} else {
req.continue();
}
});await page.route('**/*', route => {
if (['image', 'media', 'font'].includes(route.request().resourceType())) {
route.abort();
} else {
route.continue();
}
});Block by URL pattern
Modify headers
Return a fake response
Strip analytics in production scrapes
From the Rust library
Last updated
Was this helpful?

