22 lines
525 B
JavaScript
22 lines
525 B
JavaScript
// npm install https://github.com/GoogleChrome/puppeteer/
|
|
|
|
const puppeteer = require('puppeteer');
|
|
const userAgent = require('user-agents');
|
|
|
|
(async () => {
|
|
|
|
const url = process.argv[2];
|
|
const binary = process.argv[3];
|
|
const browser = await puppeteer.launch({ executablePath: binary });
|
|
const page = await browser.newPage();
|
|
await page.setUserAgent(userAgent.random().toString());
|
|
|
|
await page.goto(url, { waitUntil: 'load' });
|
|
|
|
const html = await page.content();
|
|
|
|
browser.close();
|
|
console.log(html);
|
|
|
|
})();
|