Fixed Snow Valley breaking on Transex Japan if no album is found for scene.
This commit is contained in:
parent
5ed408226d
commit
b8e9431225
|
@ -232,6 +232,10 @@ async function fetchLatestCospuri(channel, page) {
|
|||
}
|
||||
|
||||
function curatePhotos(sources) {
|
||||
if (!sources) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return sources
|
||||
.filter(Boolean).map((src) => [
|
||||
src.replace(/(\d+)s.jpg/, (match, photoIndex) => `${photoIndex}.jpg`),
|
||||
|
@ -410,7 +414,7 @@ async function fetchLatestFacefuck(channel, page) {
|
|||
}
|
||||
|
||||
function scrapeAllTrans(scenes) {
|
||||
return scenes.map(([{ query }, { query: albumQuery }]) => {
|
||||
return scenes.map(([{ query }, albumContext]) => {
|
||||
const release = {};
|
||||
|
||||
release.title = query.content('.sample-info h1');
|
||||
|
@ -419,7 +423,7 @@ function scrapeAllTrans(scenes) {
|
|||
release.description = query.content('.sample-desc')?.replace('""', '') || null; // usually empty, but let's try it just in case
|
||||
|
||||
release.duration = query.duration('.sample-info');
|
||||
release.photoCount = albumQuery.number('.sample-info', { match: /(\d+) photos/i, matchIndex: 1 });
|
||||
release.photoCount = albumContext?.query.number('.sample-info', { match: /(\d+) photos/i, matchIndex: 1 });
|
||||
|
||||
const posterBackground = query.style('.player');
|
||||
const posterUrl = posterBackground?.background?.match(/url\((.*)\)/)?.[1]?.trim();
|
||||
|
@ -432,7 +436,7 @@ function scrapeAllTrans(scenes) {
|
|||
];
|
||||
}
|
||||
|
||||
release.photos = curatePhotos(albumQuery.styles('.sample-lg, .sample-thumb').map((style) => style['background-image']?.match(/url\((.*)\)/)?.[1]));
|
||||
release.photos = curatePhotos(albumContext?.query.styles('.sample-lg, .sample-thumb').map((style) => style['background-image']?.match(/url\((.*)\)/)?.[1]));
|
||||
release.trailer = query.video();
|
||||
|
||||
release.entryId = entryIdFromMedia(release);
|
||||
|
|
Loading…
Reference in New Issue