50 lines
930 B
JavaScript
50 lines
930 B
JavaScript
'use strict';
|
|
|
|
const Promise = require('bluebird');
|
|
|
|
const argv = require('./argv');
|
|
const knex = require('./knex');
|
|
const initServer = require('./web/server');
|
|
|
|
const scrapeSites = require('./scrape-sites');
|
|
const scrapeRelease = require('./scrape-release');
|
|
const { scrapeActors, scrapeBasicActors } = require('./actors');
|
|
|
|
async function init() {
|
|
if (argv.url) {
|
|
await Promise.map(argv.url, async url => scrapeRelease(url), {
|
|
concurrency: 5,
|
|
});
|
|
|
|
knex.destroy();
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
if (argv.scrape || argv.networks || argv.sites) {
|
|
await scrapeSites();
|
|
knex.destroy();
|
|
|
|
return;
|
|
}
|
|
|
|
if (argv.actors && argv.actors.length > 0) {
|
|
await scrapeActors();
|
|
knex.destroy();
|
|
|
|
return;
|
|
}
|
|
|
|
if (argv.actors) {
|
|
await scrapeBasicActors();
|
|
knex.destroy();
|
|
|
|
return;
|
|
}
|
|
|
|
await initServer();
|
|
}
|
|
|
|
init();
|