forked from DebaucheryLibrarian/traxxx
Merging improvements.
This commit is contained in:
@@ -203,7 +203,7 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
|
||||
});
|
||||
}
|
||||
|
||||
async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
|
||||
async function scrapeScene(html, url, site, baseRelease, mobileHtml, options) {
|
||||
const $ = cheerio.load(html, { normalizeWhitespace: true });
|
||||
const m$ = mobileHtml && cheerio.load(mobileHtml, { normalizeWhitespace: true });
|
||||
const release = { $, url };
|
||||
@@ -261,7 +261,7 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
|
||||
const photoLink = $('.picturesItem a').attr('href');
|
||||
const mobilePhotos = m$ ? m$('.preview-displayer a img').map((photoIndex, photoEl) => $(photoEl).attr('src')).toArray() : [];
|
||||
|
||||
if (photoLink) {
|
||||
if (photoLink && options.includePhotos) {
|
||||
const photos = await getPhotos(photoLink, site, mobilePhotos.length < 3); // only get thumbnails when less than 3 mobile photos are available
|
||||
|
||||
if (photos.length < 7) release.photos = [...photos, ...mobilePhotos]; // probably only teaser photos available, supplement with mobile album
|
||||
@@ -312,7 +312,6 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml) {
|
||||
title: movie.attr('title'),
|
||||
entryId: movieUrl.match(/\/(\d+)(\/|$)/)?.[1],
|
||||
covers: [movie.find('img').attr('src')],
|
||||
entity: site,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -595,7 +594,7 @@ function getDeepUrl(url, site, baseRelease, mobile) {
|
||||
return url;
|
||||
}
|
||||
|
||||
async function fetchScene(url, site, baseRelease) {
|
||||
async function fetchScene(url, site, baseRelease, options) {
|
||||
if (site.parameters?.deep === false) {
|
||||
return baseRelease;
|
||||
}
|
||||
@@ -616,7 +615,7 @@ async function fetchScene(url, site, baseRelease) {
|
||||
|
||||
if (res.status === 200) {
|
||||
const mobileBody = mobileRes?.status === 200 ? mobileRes.body.toString() : null;
|
||||
const scene = await scrapeScene(res.body.toString(), url, site, baseRelease, mobileBody);
|
||||
const scene = await scrapeScene(res.body.toString(), url, site, baseRelease, mobileBody, options);
|
||||
|
||||
return { ...scene, deepUrl };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user