26 lines
532 B
JavaScript
26 lines
532 B
JavaScript
#!/usr/bin/env node
|
|
const CronJob = require('cron').CronJob;
|
|
|
|
// load env variables from file
|
|
require('dotenv').config();
|
|
|
|
const argv = require('yargs').argv;
|
|
|
|
const Slovakia = require('./ncas/sk');
|
|
|
|
async function run() {
|
|
const skScraper = new Slovakia();
|
|
|
|
if (typeof(process.env.SK_CRON) === 'string' )
|
|
new CronJob(process.env.SK_CRON, async function() {
|
|
await skScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === skScraper.id)
|
|
await skScraper.run();
|
|
|
|
console.log('SK Launched');
|
|
}
|
|
|
|
run();
|