Fixed predata parameter in Assylum scraper.

This commit is contained in:
DebaucheryLibrarian 2020-09-17 14:49:45 +02:00
parent 9c0efd7bf9
commit a9fa71e455
1 changed files with 10 additions and 7 deletions

View File

@ -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}/);
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);