Using more aggressive optional chaining in Vixen scraper to prevent errors.

This commit is contained in:
DebaucheryLibrarian 2023-07-07 00:23:02 +02:00
parent f8e7ace89f
commit 83e22813f3
1 changed files with 4 additions and 4 deletions

View File

@ -233,7 +233,7 @@ async function scrapeSceneData(data, channel, options) {
release.actors = data.models; release.actors = data.models;
release.directors = data.directors.map((director) => ({ release.directors = data.directors?.map((director) => ({
entryId: director.directorId, entryId: director.directorId,
name: director.name, name: director.name,
})); }));
@ -245,10 +245,10 @@ async function scrapeSceneData(data, channel, options) {
release.trailer = await getTrailer(release.entryId, channel, release.url); release.trailer = await getTrailer(release.entryId, channel, release.url);
} }
release.tags = data.categories.map((category) => category.name); release.tags = data.categories?.map((category) => category.name);
release.qualities = data.downloadResolutions.map((quality) => Number(quality.width)).filter(Boolean); // width property is actually the height release.qualities = data.downloadResolutions?.map((quality) => Number(quality.width)).filter(Boolean); // width property is actually the height
release.chapters = data.chapters.video?.map((chapter) => ({ release.chapters = data.chapters?.video?.map((chapter) => ({
time: chapter.seconds, time: chapter.seconds,
tags: [chapter.title], tags: [chapter.title],
})); }));