Passing network channels as site scopes in Gamma API profile scraper.

This commit is contained in:
DebaucheryLibrarian
2026-02-24 01:18:20 +01:00
parent 0fc725873e
commit b52e871cfe
2 changed files with 30 additions and 23 deletions

View File

@@ -886,7 +886,6 @@ const networks = [
layout: 'api',
sceneMovies: false,
actorScenes: 'https://www.xempire.com/en/videos/xempire/latest/{page}/All-Categories/0{actorPath}',
actorAvailableOnSites: ['allblackx', 'darkx', 'eroticax', 'hardx', 'lesbianx', 'xempire', 'xempirepartners'],
},
},
{

View File

@@ -716,27 +716,6 @@ async function scrapeProfile({ query }, url, actorName, _siteSlug, getActorRelea
return profile;
}
function scrapeApiProfile(data, releases, siteSlug) {
const profile = {};
if (data.male === 1) profile.gender = 'male';
if (data.female === 1) profile.gender = 'female';
if (data.shemale === 1 || data.trans === 1) profile.gender = 'transsexual';
if (data.description) profile.description = data.description.trim();
if (data.attributes.ethnicity) profile.ethnicity = data.attributes.ethnicity;
if (data.attributes.eye_color) profile.eyes = data.attributes.eye_color;
if (data.attributes.hair_color) profile.hairColor = data.attributes.hair_color;
const avatarPaths = Object.values(data.pictures).reverse();
if (avatarPaths.length > 0) profile.avatar = avatarPaths.map((avatarPath) => `https://images01-evilangel.gammacdn.com/actors${avatarPath}`);
if (releases) profile.releases = releases.map((release) => `https://${siteSlug}.com/en/video/${release.url_title}/${release.clip_id}`);
return profile;
}
async function fetchUpcomingApi(site, page = 1, options, preData) {
return fetchLatestApi(site, page, options, preData, true);
}
@@ -925,6 +904,27 @@ async function fetchProfile({ name: actorName }, context, include, altSearchUrl,
return null;
}
function scrapeApiProfile(data, releases, siteSlug) {
const profile = {};
if (data.male === 1) profile.gender = 'male';
if (data.female === 1) profile.gender = 'female';
if (data.shemale === 1 || data.trans === 1) profile.gender = 'transsexual';
if (data.description) profile.description = data.description.trim();
if (data.attributes.ethnicity) profile.ethnicity = data.attributes.ethnicity;
if (data.attributes.eye_color) profile.eyes = data.attributes.eye_color;
if (data.attributes.hair_color) profile.hairColor = data.attributes.hair_color;
const avatarPaths = Object.values(data.pictures).reverse();
if (avatarPaths.length > 0) profile.avatar = avatarPaths.map((avatarPath) => `https://images01-evilangel.gammacdn.com/actors${avatarPath}`);
if (releases) profile.releases = releases.map((release) => `https://${siteSlug}.com/en/video/${release.url_title}/${release.clip_id}`);
return profile;
}
async function fetchApiProfile({ name: actorName }, context, include) {
const siteSlug = context.entity.slug || context.site?.slug || context.network?.slug;
const actorSlug = encodeURI(actorName);
@@ -932,7 +932,13 @@ async function fetchApiProfile({ name: actorName }, context, include) {
const { apiUrl } = await fetchApiCredentials(referer);
const availableOnSites = (context.parameters.actorAvailableOnSites || [siteSlug]).map((site) => `"availableOnSite:${site}"`).join(',');
const availableOnSites = (context.parameters.actorAvailableOnSites
|| [
siteSlug,
...(context.entity.type === 'network'
? context.entity.children.map((networkChannel) => networkChannel.slug)
: []),
]).map((site) => `"availableOnSite:${site}"`).join(',');
const res = await http.post(apiUrl, {
requests: [
@@ -950,6 +956,8 @@ async function fetchApiProfile({ name: actorName }, context, include) {
encodeJSON: true,
});
console.log(res.status, res.body.results[0].hits[0]);
if (res.status === 200 && res.body.results[0].hits.length > 0) {
const actorData = res.body.results[0].hits.find((actor) => slugify(actor.name) === slugify(actorName));