From 639ad6c79e065d1462b353464b63dbc2ee95487e Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 19 Nov 2024 04:46:43 +0100 Subject: [PATCH] Fixed Bang Bros URL path. --- seeds/01_networks.js | 1 + src/scrapers/aylo.js | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/seeds/01_networks.js b/seeds/01_networks.js index 84614f29..9f92f7e2 100755 --- a/seeds/01_networks.js +++ b/seeds/01_networks.js @@ -185,6 +185,7 @@ const networks = [ parent: 'wgcz', parameters: { preferSpartanId: true, + scene: 'https://bangbros.com/video', }, }, { diff --git a/src/scrapers/aylo.js b/src/scrapers/aylo.js index ba4e398b..ca2b2742 100755 --- a/src/scrapers/aylo.js +++ b/src/scrapers/aylo.js @@ -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, }));