Added profile releases for classic Fame Digital sites (Silvia Saint and Silverstone DVD).

This commit is contained in:
2020-02-07 03:40:11 +01:00
parent 49405b953f
commit 30963b94dd
7 changed files with 75 additions and 19 deletions

View File

@@ -1,7 +1,18 @@
'use strict';
const argv = require('../argv');
const { fetchLatest, fetchApiLatest, fetchUpcoming, fetchApiUpcoming, fetchScene, fetchProfile, fetchApiProfile } = require('./gamma');
const {
fetchLatest,
fetchApiLatest,
fetchUpcoming,
fetchApiUpcoming,
fetchScene,
fetchProfile,
fetchApiProfile,
scrapeAll,
} = require('./gamma');
const { get } = require('../utils/q');
const slugify = require('../utils/slugify');
function extractLowArtActors(release) {
const actors = release.title
@@ -47,16 +58,40 @@ function getActorReleasesUrl(actorPath, page = 1) {
return `https://www.peternorth.com/en/videos/All-Categories/0${actorPath}/All-Dvds/0/latest/${page}`;
}
async function fetchClassicProfile(actorName, siteSlug) {
const actorSlug = slugify(actorName);
const url = `https://${siteSlug}.com/en/pornstars`;
const { qa } = await get(url);
const actorPath = qa('option[value*="/pornstar"]')
.find(el => slugify(el.textContent) === actorSlug)
?.value;
if (actorPath) {
const actorUrl = `https://${siteSlug}.com${actorPath}`;
const { html } = await get(actorUrl);
const releases = scrapeAll(html, null, `https://www.${siteSlug}.com`, false);
return { releases };
}
return null;
}
async function networkFetchProfile(actorName) {
// not all Fame Digital sites offer Gamma actors
const [devils, rocco, peter] = await Promise.all([
const [devils, rocco, peter, silvia] = await Promise.all([
fetchApiProfile(actorName, 'devilsfilm', true),
fetchApiProfile(actorName, 'roccosiffredi'),
argv.withReleases ? fetchProfile(actorName, 'peternorth', true, getActorReleasesUrl) : [],
argv.withReleases ? fetchClassicProfile(actorName, 'silviasaint') : [],
argv.withReleases ? fetchClassicProfile(actorName, 'silverstonedvd') : [],
]);
if (devils || rocco || peter) {
const releases = [].concat(devils?.releases || [], rocco?.releases || [], peter?.releases || []);
const releases = [].concat(devils?.releases || [], rocco?.releases || [], peter?.releases || [], silvia?.releases || []);
return {
...peter,

View File

@@ -110,7 +110,7 @@ async function scrapeApiReleases(json, site) {
});
}
function scrapeAll(html, site, networkUrl) {
function scrapeAll(html, site, networkUrl, hasTeaser = true) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const scenesElements = $('li[data-itemtype=scene]').toArray();
@@ -146,10 +146,12 @@ function scrapeAll(html, site, networkUrl) {
const posterEl = $(element).find('.imgLink img');
if (posterEl) release.poster = posterEl.attr('data-original') || posterEl.attr('src');
release.teaser = {
src: `https://videothumb.gammacdn.com/307x224/${release.entryId}.mp4`,
quality: 224,
};
if (hasTeaser) {
release.teaser = {
src: `https://videothumb.gammacdn.com/307x224/${release.entryId}.mp4`,
quality: 224,
};
}
return release;
});
@@ -166,7 +168,7 @@ async function scrapeScene(html, url, site) {
const videoData = JSON.parse(videoJson.slice(videoJson.indexOf('{'), videoJson.indexOf('};') + 1));
[release.entryId] = new URL(url).pathname.split('/').slice(-1);
release.title = data?.name || videoData.playerOptions.sceneInfos.sceneTitle;
release.title = videoData?.playerOptions?.sceneInfos.sceneTitle || data?.name;
// date in data object is not the release date of the scene, but the date the entry was added; only use as fallback
const dateString = $('.updatedDate').first().text().trim();