Open ifeiwu opened 5 years ago
lib/site-scan.js
// Take the screenshot try { await page.screenshot({ path: ${options.path}${fileName}.png, fullPage: options.full, omitBackground: options.transparent, type: options.jpeg ? 'jpeg' : 'png', quality: options.quality }); } catch(e) { console.log(chalk{red • Error taking screenshot of ${url}. Skipping...}); return; }
${options.path}${fileName}.png
{red • Error taking screenshot of ${url}. Skipping...}
console.log(chalk{green ✔ Screenshot saved to ${fileName}.png});
{green ✔ Screenshot saved to ${fileName}.png}
改为
let image_type = options.jpeg ? 'jpeg' : 'png';
// Take the screenshot try { await page.screenshot({ path: ${options.path}${fileName}.${image_type}, fullPage: options.full, omitBackground: options.transparent, type: image_type, quality: options.quality }); } catch(e) { console.log(chalk{red • Error taking screenshot of ${url}. Skipping...}); return; }
${options.path}${fileName}.${image_type}
console.log(chalk{green ✔ Screenshot saved to ${fileName}.${image_type}});
{green ✔ Screenshot saved to ${fileName}.${image_type}}
lib/site-scan.js
// Take the screenshot try { await page.screenshot({ path:
${options.path}${fileName}.png
, fullPage: options.full, omitBackground: options.transparent, type: options.jpeg ? 'jpeg' : 'png', quality: options.quality });} catch(e) { console.log(chalk
{red • Error taking screenshot of ${url}. Skipping...}
); return; }console.log(chalk
{green ✔ Screenshot saved to ${fileName}.png}
);改为
let image_type = options.jpeg ? 'jpeg' : 'png';
// Take the screenshot try { await page.screenshot({ path:
${options.path}${fileName}.${image_type}
, fullPage: options.full, omitBackground: options.transparent, type: image_type, quality: options.quality });} catch(e) { console.log(chalk
{red • Error taking screenshot of ${url}. Skipping...}
); return; }console.log(chalk
{green ✔ Screenshot saved to ${fileName}.${image_type}}
);