obdfcascrape/se.js

32 lines
716 B
JavaScript
Raw Normal View History

2019-05-05 19:13:56 +00:00
#!/usr/bin/env node
const CronJob = require('cron').CronJob;
// load env variables from file
require('dotenv').config();
// TODO:
// parse arguments - we should run just 1 FCA per go &
// have option to run selected company from selected NCA
const argv = require('yargs').argv;
// load helper libs etc
// const Fca = require('./ncas/fca');
const Sweden = require('./ncas/se');
async function run() {
const seScraper = new Sweden();
if (typeof(process.env.SE_CRON) === 'string' )
new CronJob(process.env.SE_CRON, async function() {
await seScraper.run();
}, null, true);
if (process.env.SCRAPE_START === seScraper.id)
await seScraper.run();
console.log('SE Launched');
}
run();