This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
BWTAqua/PageSaver/pageSaver.js

22 lines
525 B
JavaScript
Raw Normal View History

2022-09-08 13:12:25 +03:00
// npm install https://github.com/GoogleChrome/puppeteer/
const puppeteer = require('puppeteer');
2023-01-14 14:24:44 +02:00
const userAgent = require('user-agents');
2022-09-08 13:12:25 +03:00
(async () => {
const url = process.argv[2];
2023-07-14 13:08:40 +03:00
const binary = process.argv[3];
2023-07-14 13:07:06 +03:00
const browser = await puppeteer.launch({ executablePath: binary });
2022-09-08 13:12:25 +03:00
const page = await browser.newPage();
2023-01-14 14:24:44 +02:00
await page.setUserAgent(userAgent.random().toString());
2023-07-14 13:07:06 +03:00
await page.goto(url, { waitUntil: 'load' });
2022-09-08 13:12:25 +03:00
const html = await page.content();
browser.close();
console.log(html);
})();