Using base poster as fallback for deep poster in merge. Improved Naughty America scraper for live scenes.

This commit is contained in:
DebaucheryLibrarian 2024-07-09 02:19:23 +02:00
parent 325e8ea77d
commit b8e7029cef
2 changed files with 15 additions and 6 deletions

View File

@ -191,11 +191,18 @@ async function scrapeRelease(baseRelease, entitiesByHostname, type = 'scene') {
}),
}), {});
curatedScrapedRelease.poster = null;
const mergedRelease = {
...merge(baseRelease, curatedScrapedRelease, {
dedupeStringsInArrayValues: true,
hardMergeKeys: ['actors', 'covers', 'poster', 'trailer', 'teaser'],
ignoreKeys: ['poster'],
}),
poster: Array.from(new Set([
...[].concat(curatedScrapedRelease.poster),
...[].concat(baseRelease.poster),
])).filter(Boolean),
photos: curatedScrapedRelease.photos?.length > 0
? curatedScrapedRelease.photos
: baseRelease.photos,

View File

@ -25,9 +25,9 @@ function scrapeLatest(scenes, channel) {
release.poster = [
...(query.sourceSet('source[data-srcset*="scenes/"][type="image/jpeg"]', 'data-srcset') || []),
query.img('.main-scene-img', { attribute: 'data-srcset' }),
query.img('.main-scene-img', { attribute: 'srcset' }),
query.img('.scene-thumb'),
];
].filter(Boolean);
release.tags = query.contents('.flag-bg');
@ -44,16 +44,17 @@ function scrapeLatest(scenes, channel) {
function scrapeScene({ query }, { url }) {
const release = {};
release.entryId = new URL(url).pathname.match(/-(\d+)$/)?.[1];
release.title = query.content('.scene-title, .grey-title');
release.title = query.content('.breadcrumb-item.active') || query.content('.scene-title, .grey-title'); // main title has performer name instead of scene title in live scenes
release.description = query.text('.synopsis, .scene-description');
release.date = query.date('.entry-date, .released-date', ['MMM D, YYYY', 'MM/DD/YY']);
release.duration = query.duration('.duration');
release.actors = query.exists('.performer-list')
? query.all('.performer-list a, .grey-performers a').map((actorEl) => ({
release.actors = query.exists('.performer-list') || query.exists('.scene-info a[href*="/pornstar"].scene-title') // title links to performer in live scenes
? query.all('.performer-list a, .grey-performers a, .scene-info a[href*="/pornstar"].scene-title').map((actorEl) => ({
name: unprint.query.content(actorEl),
url: unprint.query.url(actorEl, null),
}))
@ -64,7 +65,8 @@ function scrapeScene({ query }, { url }) {
...(query.sourceSet('.scenepage-video source[srcset*="scenes/"][type="image/jpeg"]', 'srcset') || []),
query.img('.play-trailer img[data-srcset*="scenes/"]', { attribute: 'data-srcset' }),
query.img('.scenepage-video .playcard'),
];
query.img('.scene-page .start-card'),
].filter(Boolean);
release.photos = query.els('.contain-scene-images.desktop-only .scene-image').map((imgEl) => [
unprint.query.url(imgEl, null),