24 lines
491 B
JavaScript
24 lines
491 B
JavaScript
#!/usr/bin/env node
|
|
const CronJob = require('cron').CronJob;
|
|
|
|
// load env variables from file
|
|
require('dotenv').config();
|
|
|
|
const Poland = require('./ncas/pl');
|
|
|
|
async function run() {
|
|
const plScraper = new Poland();
|
|
|
|
if (typeof(process.env.PL_CRON) === 'string' )
|
|
new CronJob(process.env.PL_CRON, async function() {
|
|
await plScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === plScraper.id)
|
|
await plScraper.run();
|
|
|
|
console.log('PL Launched');
|
|
}
|
|
|
|
run();
|