You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
733 B
JavaScript
33 lines
733 B
JavaScript
import 'dotenv/config'
|
|
import puppeteer from 'puppeteer'
|
|
|
|
import fetchILMeteo from './scrapers/iLMeteo.js'
|
|
import fetch3Bmeteo from './scrapers/3Bmeteo.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 [iLMeteo, treBmeteo, openMeteo] = await Promise.all([
|
|
fetchILMeteo(browser),
|
|
fetch3Bmeteo(browser),
|
|
fetchOpenMeteo(),
|
|
])
|
|
|
|
await browser.close()
|
|
|
|
return {
|
|
iLMeteo,
|
|
treBmeteo,
|
|
openMeteo,
|
|
}
|
|
}
|
|
|
|
const result = await run()
|
|
console.dir(result, { depth: null })
|