Improved scene merging. Improved Porn World/DDF scraper for poster and title redundancy. Fixed SFW poster showing in NSFW mode.

This commit is contained in:
DebaucheryLibrarian 2021-01-25 23:53:56 +01:00
parent 5a975ad0bf
commit b506a00e7d
3 changed files with 19 additions and 10 deletions

View File

@ -116,7 +116,7 @@ function sfw() {
function poster() {
if (this.release.poster) {
return sfw ? `/img/${this.release.poster.sfw.thumbnail}` : `/media/${this.release.poster.thumbnail}`;
return this.sfw ? `/img/${this.release.poster.sfw.thumbnail}` : `/media/${this.release.poster.thumbnail}`;
}
if (this.release.covers?.length > 0) {

View File

@ -141,8 +141,17 @@ async function scrapeRelease(baseRelease, entities, type = 'scene') {
? await fetchScene(layoutScraper, baseRelease.url, entity, baseRelease, include, null)
: await layoutScraper.fetchMovie(baseRelease.url, entity, baseRelease, include, null);
// object-merge-advance will use null as explicit false on hard merged keys, even when null as explicit falls is disabled
// filter out keys with null values to ensure original base value is used instead
const curatedScrapedRelease = Object.entries(scrapedRelease).reduce((acc, [key, value]) => ({
...acc,
...(value !== null && value !== undefined && {
[key]: value,
}),
}), {});
const mergedRelease = {
...merge(baseRelease, scrapedRelease, {
...merge(baseRelease, curatedScrapedRelease, {
dedupeStringsInArrayValues: true,
hardMergeKeys: ['actors', 'poster', 'trailer', 'teaser'],
}),

View File

@ -32,8 +32,8 @@ async function scrapeScene({ query }, url, _site) {
release.entryId = url.match(/\/(\d+)$/)[1];
release.title = query.meta('itemprop=name') || query.q('.video-title h1', true) || query.q('.about-text .story-title') || query.q('h3', true);
release.description = query.q('.descr-box p', true) || query.q('.about-text p:not(.story-title)', true) || query.text('.description p');
release.title = query.meta('itemprop=name') || query.cnt('.video-title h1, .about-text .story-title, .video-specs h1') || query.cnt('h3');
release.description = query.cnt('.descr-box p') || query.cnt('.about-text p:not(.story-title)') || query.text('.description p');
release.date = query.date('meta[itemprop=uploadDate]', 'YYYY-MM-DD', null, 'content')
|| query.date('.actors time', 'MMMM DD, YYYY')
@ -41,15 +41,15 @@ async function scrapeScene({ query }, url, _site) {
|| query.date('.length', 'MMMM DD, YYYY', /\w+ \d{2}, \d{4}/);
if (query.exists('.pornstar-card > a')) release.actors = query.all('.pornstar-card > a', 'title');
else if (query.exists('.actors a')) release.actors = query.all('.actors a', true);
else if (query.exists('.actors a')) release.actors = query.cnts('.actors a');
if (query.exists('.tags-tab')) release.tags = query.all('.tags-tab .tags a', true);
else if (query.exists('.tags-box')) release.tags = query.all('.tags-box .tags li', true);
if (query.exists('.tags-tab')) release.tags = query.cnts('.tags-tab .tags a');
else if (query.exists('.tags-box')) release.tags = query.cnts('.tags-box .tags li');
release.duration = parseInt(query.q('.icon-video-red + span', true), 10) * 60 || query.dur('.length') || null;
release.likes = Number(query.q('.icon-like-red + span', true)) || null;
release.duration = parseInt(query.cnt('.icon-video-red + span'), 10) * 60 || query.dur('.length') || null;
release.likes = Number(query.cnt('.icon-like-red + span')) || null;
release.poster = query.poster() || query.poster('dl8-video');
release.poster = query.poster() || query.poster('dl8-video') || query.img('#videoBlock img');
release.photos = query.urls('.photo-slider-guest .card a');
release.trailer = query.all('source[type="video/mp4"]').map(trailer => ({