Including unextracted scenes in date determination.

This commit is contained in:
DebaucheryLibrarian
2021-10-28 02:10:30 +02:00
parent 83dd233991
commit 29b8c5e38e
2 changed files with 16 additions and 22 deletions

View File

@@ -45,21 +45,6 @@ function getVideos(data) {
}
function scrapeLatestX(data, site, filterChannel) {
if (site.parameters?.extract === true && data.collections.length > 0) {
// release should not belong to any channel
return null;
}
if (typeof site.parameters?.extract === 'string' && !data.collections.some(collection => collection.shortName === site.parameters.extract)) {
// release should belong to specific channel
return null;
}
if (filterChannel && !data.collections?.some(collection => collection.id === site.parameters?.siteId)) {
// used to separate upcoming Brazzers scenes
return null;
}
const release = {
entryId: data.id,
title: data.title,
@@ -90,16 +75,24 @@ function scrapeLatestX(data, site, filterChannel) {
tags: [chapter.name],
}));
if ((site.parameters?.extract === true && data.collections.length > 0) // release should not belong to any channel
|| (typeof site.parameters?.extract === 'string' && !data.collections.some(collection => collection.shortName === site.parameters.extract)) // release should belong to specific channel
|| (filterChannel && !data.collections?.some(collection => collection.id === site.parameters?.siteId))) { // used to separate upcoming Brazzers scenes
return {
...release,
exclude: true,
};
}
return release;
}
async function scrapeLatest(items, site, filterChannel) {
const latestReleases = items.map(data => scrapeLatestX(data, site, filterChannel));
const extractedScenes = latestReleases.filter(Boolean);
return {
scenes: extractedScenes,
unextracted: latestReleases.length - extractedScenes.length,
scenes: latestReleases.filter(scene => !scene.exclude),
unextracted: latestReleases.filter(scene => scene.exclude),
};
}