await page.setRequestInterception(true);
page.on('request', async (req) => {
  if (req.resourceType() !== 'image') {            
    return req.continue();
  }
  try {
    const res = await axios.get(req.url(), { responseType: 'arraybuffer' });            
    const jpeg = await sharp(res.data).webp().toBuffer();
    req.respond({ body: jpeg });
  } catch(e) {
    console.log(e);
    req.continue();
  }
});
await page.goto(url);