Adding scraper config by scraper slug to current 'includes' parameter.

This commit is contained in:
DebaucheryLibrarian
2020-10-28 01:36:13 +01:00
parent 1869877178
commit bf9b334b73
4 changed files with 37 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
'use strict';
const config = require('config');
const Promise = require('bluebird');
const moment = require('moment');
@@ -93,9 +94,14 @@ function needNextPage(pageReleases, accReleases, isUpcoming) {
async function scrapeReleases(scraper, entity, preData, isUpcoming) {
async function scrapeReleasesPage(page, accReleases) {
const options = {
...config.options[scraper.slug],
...include,
};
const pageReleases = isUpcoming
? await scraper.fetchUpcoming(entity, page, include, preData)
: await scraper.fetchLatest(entity, page, include, preData);
? await scraper.fetchUpcoming(entity, page, options, preData)
: await scraper.fetchLatest(entity, page, options, preData);
if (!Array.isArray(pageReleases)) {
// scraper is unable to fetch the releases and returned a HTTP code or null