Added Brazzers and Jules Jordan as profile sources. Changed profile structure for proper bust-waist-hip properties and improved stability.

This commit is contained in:
2019-11-21 04:05:32 +01:00
parent 9fcc40dd17
commit 9224b441e2
12 changed files with 224 additions and 60 deletions

View File

@@ -37,8 +37,10 @@ async function curateActor(actor) {
: null,
ethnicity: actor.ethnicity,
height: actor.height,
boobSize: actor.boobs_size,
boobsNatural: actor.boobs_natural,
bust: actor.bust,
waist: actor.waist,
hip: actor.hip,
naturalBoobs: actor.natural_boobs,
aliases: aliases.map(({ name }) => name),
slug: actor.slug,
avatars,
@@ -51,7 +53,6 @@ function curateActors(releases) {
function curateActorEntry(actor, scraped, scrapeSuccess) {
const curatedActor = {
id: actor.id,
name: actor.name
.split(' ')
.map(segment => `${segment.charAt(0).toUpperCase()}${segment.slice(1)}`)
@@ -65,22 +66,27 @@ function curateActorEntry(actor, scraped, scrapeSuccess) {
residence_country_alpha2: actor.residenceCountry,
birth_place: actor.birthPlace,
residence_place: actor.residencePlace,
boobs_size: actor.boobs && actor.boobs.size,
boobs_natural: actor.boobs && actor.boobs.natural,
bust: actor.bust,
waist: actor.waist,
hip: actor.hip,
natural_boobs: actor.naturalBoobs,
height: actor.height,
weight: actor.weight,
hair: actor.hair,
eyes: actor.eyes,
has_tattoos: actor.hasTattoos,
has_piercings: actor.hasPiercings,
tattoos: actor.tattoos,
piercings: actor.piercings,
};
if (actor.id) {
curatedActor.id = actor.id;
}
if (scraped) {
return {
...curatedActor,
scraped_at: new Date(),
scrape_success: scrapeSuccess,
};
curatedActor.scraped_at = new Date();
curatedActor.scrape_success = scrapeSuccess;
}
return curatedActor;
@@ -141,30 +147,32 @@ function mergeProfiles(profiles, actor) {
}
return {
id: actor.id,
name: actor.name,
id: actor ? actor.id : null,
name: actor ? actor.name : profile.name,
description: prevProfile.description || profile.description,
gender: prevProfile.gender || profile.gender,
birthdate: prevProfile.birthdate || profile.birthdate,
birthdate: Number.isNaN(prevProfile.birthdate) ? profile.birthdate : prevProfile.birthdate,
birthCountry: prevProfile.birthCountry || profile.birthCountry,
residenceCountry: prevProfile.residenceCountry || profile.residenceCountry,
birthPlace: prevProfile.birthPlace || profile.birthPlace,
residencePlace: prevProfile.residencePlace || profile.residencePlace,
ethnicity: prevProfile.ethnicity || profile.ethnicity,
boobs: profile.boobs
? {
size: prevProfile.boobs.size || profile.boobs.size,
natural: prevProfile.boobs.natural || profile.boobs.natural,
}
: {},
bust: prevProfile.bust || profile.bust,
waist: prevProfile.waist || profile.waist,
hip: prevProfile.hip || profile.hip,
naturalBoobs: prevProfile.naturalBoobs || profile.naturalBoobs,
height: prevProfile.height || profile.height,
weight: prevProfile.weight || profile.weight,
hair: prevProfile.hair || profile.hair,
eyes: prevProfile.eyes || profile.eyes,
hasPiercings: prevProfile.hasPiercings || profile.hasPiercings,
hasTattoos: prevProfile.hasTattoos || profile.hasTattoos,
piercings: prevProfile.piercings || profile.piercings,
tattoos: prevProfile.tattoos || profile.tattoos,
social: prevProfile.social.concat(profile.social || []),
avatars: prevProfile.avatars.concat(profile.avatar || []),
};
}, {
boobs: {},
social: [],
avatars: [],
...actor,
@@ -176,7 +184,11 @@ async function scrapeActors(actorNames) {
const actorSlug = actorName.toLowerCase().replace(/\s+/g, '-');
const actorEntry = await knex('actors').where({ slug: actorSlug }).first();
const profiles = await Promise.all(Object.values(scrapers.actors).map(scraper => scraper.fetchProfile(actorEntry ? actorEntry.name : actorName)));
const profiles = await Promise.all(
Object.values(scrapers.actors)
.map(scraper => scraper.fetchProfile(actorEntry ? actorEntry.name : actorName)),
);
const profile = mergeProfiles(profiles, actorEntry);
if (profile === null) {
@@ -203,7 +215,7 @@ async function scrapeActors(actorNames) {
await createActorMediaDirectory(profile, newActorEntry);
await storeAvatars(profile, newActorEntry);
}, {
concurrency: 1,
concurrency: 3,
});
}