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,