lino-levan / astral

A high-level puppeteer/playwright-like library for Deno
https://jsr.io/@astral/astral
MIT License
215 stars 10 forks source link

Alternative to `await page.setRequestInterception(true);`? #55

Open ghost opened 6 months ago

ghost commented 6 months ago

Hello,

on Puppeteer, you can do:

page = await browser.newPage();
await page.setRequestInterception(true);
page.on('request', (request) => {
    if (['image', 'stylesheet', 'font', 'script'].indexOf(request.resourceType()) !== -1) {
        request.abort();
    } else {
        request.continue();
    }
});

To prevent downloading unwanted assets, how can I do that on Astral?

lino-levan commented 6 months ago

I'm working on a nice API for this, but this is doable right now via the celestial bindings.