Using base poster as fallback for deep poster in merge. Improved Naughty America scraper for live scenes.
This commit is contained in:
parent
325e8ea77d
commit
b8e7029cef
|
@ -191,11 +191,18 @@ async function scrapeRelease(baseRelease, entitiesByHostname, type = 'scene') {
|
||||||
}),
|
}),
|
||||||
}), {});
|
}), {});
|
||||||
|
|
||||||
|
curatedScrapedRelease.poster = null;
|
||||||
|
|
||||||
const mergedRelease = {
|
const mergedRelease = {
|
||||||
...merge(baseRelease, curatedScrapedRelease, {
|
...merge(baseRelease, curatedScrapedRelease, {
|
||||||
dedupeStringsInArrayValues: true,
|
dedupeStringsInArrayValues: true,
|
||||||
hardMergeKeys: ['actors', 'covers', 'poster', 'trailer', 'teaser'],
|
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
|
photos: curatedScrapedRelease.photos?.length > 0
|
||||||
? curatedScrapedRelease.photos
|
? curatedScrapedRelease.photos
|
||||||
: baseRelease.photos,
|
: baseRelease.photos,
|
||||||
|
|
|
@ -25,9 +25,9 @@ function scrapeLatest(scenes, channel) {
|
||||||
|
|
||||||
release.poster = [
|
release.poster = [
|
||||||
...(query.sourceSet('source[data-srcset*="scenes/"][type="image/jpeg"]', 'data-srcset') || []),
|
...(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'),
|
query.img('.scene-thumb'),
|
||||||
];
|
].filter(Boolean);
|
||||||
|
|
||||||
release.tags = query.contents('.flag-bg');
|
release.tags = query.contents('.flag-bg');
|
||||||
|
|
||||||
|
@ -44,16 +44,17 @@ function scrapeLatest(scenes, channel) {
|
||||||
|
|
||||||
function scrapeScene({ query }, { url }) {
|
function scrapeScene({ query }, { url }) {
|
||||||
const release = {};
|
const release = {};
|
||||||
|
|
||||||
release.entryId = new URL(url).pathname.match(/-(\d+)$/)?.[1];
|
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.description = query.text('.synopsis, .scene-description');
|
||||||
|
|
||||||
release.date = query.date('.entry-date, .released-date', ['MMM D, YYYY', 'MM/DD/YY']);
|
release.date = query.date('.entry-date, .released-date', ['MMM D, YYYY', 'MM/DD/YY']);
|
||||||
release.duration = query.duration('.duration');
|
release.duration = query.duration('.duration');
|
||||||
|
|
||||||
release.actors = query.exists('.performer-list')
|
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').map((actorEl) => ({
|
? query.all('.performer-list a, .grey-performers a, .scene-info a[href*="/pornstar"].scene-title').map((actorEl) => ({
|
||||||
name: unprint.query.content(actorEl),
|
name: unprint.query.content(actorEl),
|
||||||
url: unprint.query.url(actorEl, null),
|
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.sourceSet('.scenepage-video source[srcset*="scenes/"][type="image/jpeg"]', 'srcset') || []),
|
||||||
query.img('.play-trailer img[data-srcset*="scenes/"]', { attribute: 'data-srcset' }),
|
query.img('.play-trailer img[data-srcset*="scenes/"]', { attribute: 'data-srcset' }),
|
||||||
query.img('.scenepage-video .playcard'),
|
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) => [
|
release.photos = query.els('.contain-scene-images.desktop-only .scene-image').map((imgEl) => [
|
||||||
unprint.query.url(imgEl, null),
|
unprint.query.url(imgEl, null),
|
||||||
|
|
Loading…
Reference in New Issue