Sha256: 94602100a174c0d392778a8fc165f8653b069d93af3b862d6fc220eb718f2b95

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

'use strict';
const dhalang = require('./dhalang');
const fs = require('node:fs');

const scrapeHtml = async () => {
    const configuration = dhalang.getConfiguration();

    let browser;
    try {
        browser = await dhalang.launchPuppeteer(configuration);
        const page = await browser.newPage();
        await dhalang.configure(page, configuration.userOptions);
        await dhalang.navigate(page, configuration);
        const html = await page.content();
        fs.writeFileSync(configuration.tempFilePath, html);
    } catch (error) {
        console.error(error.message);
        process.exit(1);
    } finally {
        if (browser) {
            browser.close();
        }
        process.exit(0);
    }
};
scrapeHtml();

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Dhalang-0.7.0 lib/js/html-scraper.js