SHARE
TWEET

Untitled

a guest Jun 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const puppeteer = require('puppeteer');
  2. async function doScreenCapture(url, site_name) {
  3.     let browser = await puppeteer.launch({ headless: false });
  4.     let page = await browser.newPage();
  5.     await page.goto(url);
  6.     await page.setViewport({width: 1382, height: 717})
  7.     await page.waitFor(1000);
  8.     console.log('do screen capture running');
  9.     await page.screenshot({ path:`${site_name}.png`, fullPage: true });
  10.     await page.close();
  11.     await browser.close();
  12.   }
  13. async function run() {
  14.     console.log('running');
  15.     var fs = require("fs");
  16.     var text = fs.readFileSync("linksList.txt").toString().split("n");
  17.  
  18.     for (var i = 0; i < text.length; ++i) {
  19.             doScreenCapture(text[i], "image"+i)
  20.             console.log("image"+i+" completed");
  21.             await page.waitFor(5000);
  22.         }
  23.  }
  24.  
  25. run();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top