Fixed Bang! scraped failing when scene has no photos.

This commit is contained in:
DebaucheryLibrarian 2022-02-12 03:26:40 +01:00
parent ba18a3dadb
commit c7710afdbf
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ const qu = require('../utils/qu');
const { extractDate } = require('../utils/qu');
const { inchesToCm } = require('../utils/convert');
const slugify = require('../utils/slugify');
const capitalize = require('../utils/capitalize');
const clusterId = '617fb597b659459bafe6472470d9073a';
const authKey = 'YmFuZy1yZWFkOktqVDN0RzJacmQ1TFNRazI=';
@ -15,6 +16,10 @@ const genderMap = {
};
function getScreenUrl(item, scene) {
if (!scene.dvd?.id || !item.screenId) {
return null;
}
return `https://i.bang.com/screenshots/${scene.dvd.id}/${scene.type}/${scene.order}/${item.screenId}.jpg`;
}
@ -57,7 +62,7 @@ async function fetchPhotos(scene) {
async function scrapeScene(scene, entity, options) {
const release = {
entryId: scene.id,
title: scene.name,
title: scene.name || (scene.dvd?.name && scene.type === 'bonus' && capitalize(`${scene.dvd.name} - Bonus Scene ${scene.order || 1}`)) || null,
description: scene.description,
tags: scene.genres.concat(scene.actions).map((genre) => genre.name),
duration: scene.duration,