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);