From 1a74bdb68a63305a2e4f9bfb4b2bc29abd60ddfe Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 25 Aug 2024 21:39:05 +0200 Subject: [PATCH] Fixed Jules Jordan poster returning page URL. --- assets/img/icons/pencil2.svg | 4 ++++ assets/img/icons/pencil3.svg | 4 ++++ assets/img/icons/pencil5.svg | 5 +++++ assets/img/icons/pencil7.svg | 5 +++++ src/scrapers/julesjordan.js | 8 +++++--- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 assets/img/icons/pencil2.svg create mode 100755 assets/img/icons/pencil3.svg create mode 100755 assets/img/icons/pencil5.svg create mode 100755 assets/img/icons/pencil7.svg diff --git a/assets/img/icons/pencil2.svg b/assets/img/icons/pencil2.svg new file mode 100755 index 00000000..519bcca9 --- /dev/null +++ b/assets/img/icons/pencil2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/img/icons/pencil3.svg b/assets/img/icons/pencil3.svg new file mode 100755 index 00000000..70e3216b --- /dev/null +++ b/assets/img/icons/pencil3.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/img/icons/pencil5.svg b/assets/img/icons/pencil5.svg new file mode 100755 index 00000000..de84066a --- /dev/null +++ b/assets/img/icons/pencil5.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/img/icons/pencil7.svg b/assets/img/icons/pencil7.svg new file mode 100755 index 00000000..71317267 --- /dev/null +++ b/assets/img/icons/pencil7.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/scrapers/julesjordan.js b/src/scrapers/julesjordan.js index ba376a3f..dd0d4f67 100755 --- a/src/scrapers/julesjordan.js +++ b/src/scrapers/julesjordan.js @@ -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'),