From a9fa71e455d18712d69ec1a664059d0f941da76a Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Thu, 17 Sep 2020 14:49:45 +0200 Subject: [PATCH] Fixed predata parameter in Assylum scraper. --- src/scrapers/assylum.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/scrapers/assylum.js b/src/scrapers/assylum.js index 2e4215de..e0754333 100644 --- a/src/scrapers/assylum.js +++ b/src/scrapers/assylum.js @@ -33,6 +33,7 @@ function scrapeLatest(scenes, site, models) { const actorString = qu.q('.mas_description', true); const actors = matchActors(actorString, models); + if (actors.length > 0) release.actors = actors; else release.actors = extractActors(actorString); @@ -51,10 +52,12 @@ function scrapeScene({ html, qu }, url, site, include, models) { release.description = qu.q('.mas_longdescription', true); release.date = qu.date('.mas_description', 'MMMM DD, YYYY', /\w+ \d{1,2}, \d{4}/); - const actorString = qu.q('.mas_description', true).replace(/\w+ \d{1,2}, \d{4}/, ''); - const actors = matchActors(actorString, models); - if (actors.length > 0) release.actors = actors; - else release.actors = extractActors(actorString); + if (models) { + const actorString = qu.q('.mas_description', true).replace(/\w+ \d{1,2}, \d{4}/, ''); + const actors = matchActors(actorString, models); + if (actors.length > 0) release.actors = actors; + else release.actors = extractActors(actorString); + } release.tags = qu.all('.tags a', true); @@ -112,14 +115,14 @@ async function fetchModels(site, page = 1, accModels = []) { return []; } -async function fetchLatest(site, page = 1, models) { +async function fetchLatest(site, page = 1, include, { beforeFetchLatest }) { const url = `${site.url}/show.php?a=${site.parameters.a}_${page}`; const res = await geta(url, '.item'); - return res.ok ? scrapeLatest(res.items, site, models) : res.status; + return res.ok ? scrapeLatest(res.items, site, beforeFetchLatest) : res.status; } -async function fetchScene(url, site, release, beforeFetchLatest) { +async function fetchScene(url, site, release, include, beforeFetchLatest) { const models = beforeFetchLatest || await fetchModels(site); const res = await get(url);