Fetching and returning releases for Evil Angel actors.
This commit is contained in:
parent
4012669a3e
commit
2fef4b4314
|
@ -102,7 +102,7 @@ async function scrapeScene(html, url, site) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrapeActor(data) {
|
function scrapeActor(data, releases) {
|
||||||
const actor = {};
|
const actor = {};
|
||||||
|
|
||||||
if (data.male === 1) actor.gender = 'male';
|
if (data.male === 1) actor.gender = 'male';
|
||||||
|
@ -118,6 +118,8 @@ function scrapeActor(data) {
|
||||||
const avatarPath = Object.values(data.pictures).reverse()[0];
|
const avatarPath = Object.values(data.pictures).reverse()[0];
|
||||||
actor.avatar = `https://images01-evilangel.gammacdn.com/actors${avatarPath}`;
|
actor.avatar = `https://images01-evilangel.gammacdn.com/actors${avatarPath}`;
|
||||||
|
|
||||||
|
actor.releases = releases.map(release => `https://evilangel.com/en/video/${release.url_title}/${release.clip_id}`);
|
||||||
|
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +174,28 @@ async function fetchScene(url, site) {
|
||||||
return scrapeScene(res.body.toString(), url, site);
|
return scrapeScene(res.body.toString(), url, site);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchActorScenes(actorName, apiUrl) {
|
||||||
|
const res = await bhttp.post(apiUrl, {
|
||||||
|
requests: [
|
||||||
|
{
|
||||||
|
indexName: 'all_scenes',
|
||||||
|
params: `query=&hitsPerPage=36&maxValuesPerFacet=100&page=0&facetFilters=[["lesbian:"],["bisex:"],["shemale:"],["actors.name:${actorName}"]]`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
Referer: 'https://www.evilangel.com/en/videos',
|
||||||
|
},
|
||||||
|
encodeJSON: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res.statusCode === 200 && res.body.results[0].hits.length > 0) {
|
||||||
|
return res.body.results[0].hits;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchProfile(actorName) {
|
async function fetchProfile(actorName) {
|
||||||
const { apiUrl } = await fetchApiCredentials();
|
const { apiUrl } = await fetchApiCredentials();
|
||||||
const actorSlug = encodeURI(actorName);
|
const actorSlug = encodeURI(actorName);
|
||||||
|
@ -194,7 +218,9 @@ async function fetchProfile(actorName) {
|
||||||
const actorData = res.body.results[0].hits.find(actor => actor.name === actorName);
|
const actorData = res.body.results[0].hits.find(actor => actor.name === actorName);
|
||||||
|
|
||||||
if (actorData) {
|
if (actorData) {
|
||||||
return scrapeActor(actorData);
|
const actorScenes = await fetchActorScenes(actorName, apiUrl);
|
||||||
|
|
||||||
|
return scrapeActor(actorData, actorScenes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue