|
|
|
import 'dotenv/config'
|
|
|
|
import puppeteer from 'puppeteer'
|
|
|
|
|
|
|
|
import fetchILMeteo from './scrapers/iLMeteo.js'
|
|
|
|
import fetch3Bmeteo from './scrapers/3Bmeteo.js'
|
|
|
|
import fetchAeronauticaMilitare from './scrapers/AeronauticaMilitare.js'
|
|
|
|
import fetchOpenMeteo from './scrapers/OpenMeteo.js'
|
|
|
|
|
|
|
|
const NIX_OPS = {
|
|
|
|
executablePath: process.env.NIX_CHROMIUM_PATH,
|
|
|
|
}
|
|
|
|
const opts = process.env.ON_NIX ? NIX_OPS : {}
|
|
|
|
|
|
|
|
const run = async () => {
|
|
|
|
const browser = await puppeteer.launch(opts)
|
|
|
|
|
|
|
|
const [
|
|
|
|
// Comment out unwanted fields
|
|
|
|
iLMeteo,
|
|
|
|
treBmeteo,
|
|
|
|
openMeteo,
|
|
|
|
aeronauticaMilitare,
|
|
|
|
] = await Promise.all([
|
|
|
|
fetchILMeteo(browser),
|
|
|
|
fetch3Bmeteo(browser),
|
|
|
|
fetchOpenMeteo(),
|
|
|
|
fetchAeronauticaMilitare(browser),
|
|
|
|
])
|
|
|
|
|
|
|
|
await browser.close()
|
|
|
|
|
|
|
|
return {
|
|
|
|
iLMeteo,
|
|
|
|
treBmeteo,
|
|
|
|
openMeteo,
|
|
|
|
aeronauticaMilitare,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const result = await run()
|
|
|
|
console.dir(result, { depth: null })
|