forked from DebaucheryLibrarian/traxxx
Added profile interpolation.
This commit is contained in:
@@ -141,7 +141,7 @@ async function fetchActorReleases({ qu, html }, accReleases = []) {
|
||||
return accReleases.concat(releases);
|
||||
}
|
||||
|
||||
async function scrapeProfile(html, url, actorName) {
|
||||
async function scrapeProfile(html, url, actorName, include) {
|
||||
const qProfile = ex(html);
|
||||
const { q, qa } = qProfile;
|
||||
|
||||
@@ -175,7 +175,9 @@ async function scrapeProfile(html, url, actorName) {
|
||||
const avatarEl = q('.big-pic-model-container img');
|
||||
if (avatarEl) profile.avatar = `https:${avatarEl.src}`;
|
||||
|
||||
profile.releases = await fetchActorReleases(qProfile);
|
||||
if (include.releases) {
|
||||
profile.releases = await fetchActorReleases(qProfile);
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
@@ -198,7 +200,7 @@ async function fetchScene(url, site) {
|
||||
return scrapeScene(res.body.toString(), url, site);
|
||||
}
|
||||
|
||||
async function fetchProfile(actorName) {
|
||||
async function fetchProfile(actorName, scraperSlug, siteOrNetwork, include) {
|
||||
const searchUrl = 'https://brazzers.com/pornstars-search/';
|
||||
const searchRes = await bhttp.get(searchUrl, {
|
||||
headers: {
|
||||
@@ -212,7 +214,7 @@ async function fetchProfile(actorName) {
|
||||
const url = `https://brazzers.com${actorLink}`;
|
||||
const res = await bhttp.get(url);
|
||||
|
||||
return scrapeProfile(res.body.toString(), url, actorName);
|
||||
return scrapeProfile(res.body.toString(), url, actorName, include);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -368,7 +368,7 @@ function scrapeApiProfile(data, releases, siteSlug) {
|
||||
const avatarPaths = Object.values(data.pictures).reverse();
|
||||
if (avatarPaths.length > 0) profile.avatar = avatarPaths.map(avatarPath => `https://images01-evilangel.gammacdn.com/actors${avatarPath}`);
|
||||
|
||||
profile.releases = releases.map(release => `https://${siteSlug}.com/en/video/${release.url_title}/${release.clip_id}`);
|
||||
if (releases) profile.releases = releases.map(release => `https://${siteSlug}.com/en/video/${release.url_title}/${release.clip_id}`);
|
||||
|
||||
return profile;
|
||||
}
|
||||
@@ -579,7 +579,7 @@ async function fetchProfile(actorName, siteSlug, altSearchUrl, getActorReleasesU
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchApiProfile(actorName, siteSlug) {
|
||||
async function fetchApiProfile(actorName, siteSlug, site, include) {
|
||||
const actorSlug = encodeURI(actorName);
|
||||
const referer = `https://www.${siteSlug}.com/en/search`;
|
||||
|
||||
@@ -603,7 +603,7 @@ async function fetchApiProfile(actorName, siteSlug) {
|
||||
const actorData = res.body.results[0].hits.find(actor => slugify(actor.name) === slugify(actorName));
|
||||
|
||||
if (actorData) {
|
||||
const actorScenes = await fetchActorScenes(actorData.name, apiUrl, siteSlug);
|
||||
const actorScenes = include.releases && await fetchActorScenes(actorData.name, apiUrl, siteSlug);
|
||||
|
||||
return scrapeApiProfile(actorData, actorScenes, siteSlug);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user