Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `const AWS = require('aws-sdk');
- exports.handle = async (event, context, callback) => {
- context.callbackWaitsForEmptyEventLoop = false;
- const browser = await setup.getBrowser();
- await exports
- .run(browser, event.url)
- .then(result => {
- callback(null, result);
- })
- .catch(err => callback(err));
- };
- exports.run = async (browser, url) => {
- if (!url) throw new Error('URL is required!');
- const page = await browser.newPage();
- await page.authenticate({
- username: process.env.PROXY_USER,
- password: process.env.PROXY_PASS
- });
- await page.goto(url, {
- waitUntil: ['domcontentloaded', 'networkidle2'],
- timeout: 0
- });
- try {
- const host = new URL(url).hostname; // ЗДЕСЬ ПАДАЕТ`
Add Comment
Please, Sign In to add comment