Fixed Jules Jordan poster returning page URL.

This commit is contained in:
DebaucheryLibrarian
2024-08-25 21:39:05 +02:00
parent c7947322c1
commit 1a74bdb68a
5 changed files with 23 additions and 3 deletions

View File

@@ -169,7 +169,8 @@ async function scrapeScene({ html, query }, context) {
release.tags = query.contents('.update_tags a, .player-scene-description a[href*="/categories"]');
release.director = release.tags?.find((tag) => ['mike john', 'van styles'].includes(tag?.trim().toLowerCase()));
const posterPath = query.poster('#video-player') || html.match(/useimage = "(.*)"/)?.[1];
const posterPath = query.poster('#video-player', { forceGetAttribute: true }) // without getAttribute, missing poster is returned as page URL
|| html.match(/useimage = "(.*)"/)?.[1];
if (posterPath) {
const poster = /^http/.test(posterPath) ? posterPath : `${context.entity.url}${posterPath}`;
@@ -188,7 +189,7 @@ async function scrapeScene({ html, query }, context) {
query.video('source[data-bitrate="trailer_720" i]'),
query.video('source[data-bitrate="trailer" i]'), // also seems to be 720p
query.video('source[data-bitrate="trailer_mobile" i]'), // also seems to be 720p
];
].filter(Boolean);
} else if (context.include.trailers && context.entity.slug !== 'manuelferrara') {
release.trailer = extractLegacyTrailer(html, context);
}
@@ -198,7 +199,8 @@ async function scrapeScene({ html, query }, context) {
release.photos = getPhotos(query, release, context);
} else {
// base release photos are usually better, but deep photos have additional thumbs
// the filenames are not chronological, so sorting after appending only worsens the mix
// the filenames are not chronological, so sorting after appending only worsens the mix.
// #images img selects a list of images that is present on every page; the JJ website removes the ones that failed to load with JS (lol)
release.photos = [
...context.baseRelease?.photos?.map((sources) => sources.at(-1).src) || [],
...query.imgs('#images img'),