26 lines
526 B
JavaScript
26 lines
526 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 Spain = require('./ncas/es');
|
|
|
|
async function run() {
|
|
const esScraper = new Spain();
|
|
|
|
if (typeof(process.env.ES_CRON) === 'string' )
|
|
new CronJob(process.env.ES_CRON, async function() {
|
|
await esScraper.run();
|
|
}, null, true);
|
|
|
|
if (process.env.SCRAPE_START === esScraper.id)
|
|
await esScraper.run();
|
|
|
|
console.log('ES Launched');
|
|
}
|
|
|
|
run();
|