Fixed Bang Bros URL path.

This commit is contained in:
DebaucheryLibrarian 2024-11-19 04:46:43 +01:00
parent 32c89bcdb6
commit 639ad6c79e
2 changed files with 7 additions and 6 deletions

View File

@ -185,6 +185,7 @@ const networks = [
parent: 'wgcz',
parameters: {
preferSpartanId: true,
scene: 'https://bangbros.com/video',
},
},
{

View File

@ -11,9 +11,9 @@ const slugify = require('../utils/slugify');
const http = require('../utils/http');
const { inchesToCm, lbsToKg } = require('../utils/convert');
function getBasePath(channel, path = '/scene') {
return channel.parameters?.scene
|| ((channel.parameters?.native || channel.type === 'network') && `${channel.url}${path}`)
function getBasePath(parameters, channel, path = '/scene') {
return parameters?.scene
|| ((parameters?.native || channel.type === 'network') && `${channel.url}${path}`)
|| `${channel.parent.url}${path}`;
}
@ -79,7 +79,7 @@ function scrapeLatestX(data, site, filterChannel, options) {
description: data.description,
};
const basepath = getBasePath(site);
const basepath = getBasePath(options.parameters, site);
release.url = `${basepath}/${data.id}/${slugify(release.title)}`; // spartanId doesn't work in URLs
release.date = new Date(data.dateReleased);
@ -161,7 +161,7 @@ function scrapeRelease(data, url, channel, networkName, options) {
if (data.parent?.type === 'movie' || data.parent?.type === 'serie') {
release[data.parent.type] = {
entryId: data.parent.id,
url: `${getBasePath(channel, data.parent.type === 'movie' ? '/movie' : '/series')}/${data.parent.id}/${slugify(data.parent.title, '-', { removePunctuation: true })}`,
url: `${getBasePath(options.parameters, channel, data.parent.type === 'movie' ? '/movie' : '/series')}/${data.parent.id}/${slugify(data.parent.title, '-', { removePunctuation: true })}`,
title: data.parent.title,
description: data.parent.description,
date: new Date(data.parent.dateReleased),
@ -175,7 +175,7 @@ function scrapeRelease(data, url, channel, networkName, options) {
release.covers = getCovers(data.images);
release.scenes = data.children?.map((scene) => ({
entryId: scene.id,
url: `${getBasePath(channel)}/${scene.id}/${slugify(scene.title)}`,
url: `${getBasePath(options.parameters, channel)}/${scene.id}/${slugify(scene.title)}`,
title: scene.title,
shallow: true,
}));