Added fixed actor age. Added male profiles to Littlr Caprice Dreams scraper. Added various tag photos.
|
@ -73,7 +73,19 @@
|
|||
<span class="birthdate">{{ formatDate(actor.dateOfBirth, 'MMMM D, YYYY') }}<span
|
||||
v-if="!actor.dateOfDeath"
|
||||
class="age"
|
||||
>{{ actor.age }}</span></span>
|
||||
>{{ actor.ageFromBirth }}</span></span>
|
||||
</li>
|
||||
|
||||
<li
|
||||
v-else-if="actor.age && !actor.dateOfDeath"
|
||||
class="bio-item"
|
||||
>
|
||||
<dfn class="bio-label"><Icon icon="cake" />Age</dfn>
|
||||
|
||||
<span
|
||||
v-tooltip="'Exact date of birth or age unknown'"
|
||||
class="birthdate"
|
||||
>> {{ actor.age }}</span>
|
||||
</li>
|
||||
|
||||
<li
|
||||
|
|
|
@ -71,9 +71,15 @@
|
|||
>{{ actor.ageAtDeath }}</span>
|
||||
|
||||
<span
|
||||
v-else-if="actor.age"
|
||||
v-else-if="actor.ageFromBirth"
|
||||
v-tooltip="`Born on ${formatDate(actor.dateOfBirth, 'MMMM D, YYYY')}`"
|
||||
class="age-now"
|
||||
>{{ actor.ageFromBirth }}</span>
|
||||
|
||||
<span
|
||||
v-else-if="actor.age"
|
||||
v-tooltip="`At least ${actor.age}`"
|
||||
class="age-now"
|
||||
>{{ actor.age }}</span>
|
||||
|
||||
<span
|
||||
|
|
|
@ -100,6 +100,7 @@ async function mounted() {
|
|||
'fake-cum',
|
||||
],
|
||||
toys: [
|
||||
'toys',
|
||||
'toy-anal',
|
||||
'toy-dp',
|
||||
'double-dildo',
|
||||
|
@ -114,11 +115,13 @@ async function mounted() {
|
|||
'schoolgirl',
|
||||
'nurse',
|
||||
'maid',
|
||||
'nun',
|
||||
],
|
||||
fetish: [
|
||||
'bdsm',
|
||||
'femdom',
|
||||
'bondage',
|
||||
'latex',
|
||||
'blindfold',
|
||||
],
|
||||
extreme: [
|
||||
|
|
|
@ -40,6 +40,7 @@ function initActorActions(store, router) {
|
|||
dateOfBirth
|
||||
dateOfDeath
|
||||
age
|
||||
ageFromBirth
|
||||
ageAtDeath
|
||||
ethnicity
|
||||
cup
|
||||
|
@ -279,6 +280,7 @@ function initActorActions(store, router) {
|
|||
name
|
||||
slug
|
||||
age
|
||||
ageFromBirth
|
||||
ageAtDeath
|
||||
dateOfBirth
|
||||
dateOfDeath
|
||||
|
|
|
@ -253,6 +253,7 @@ exports.up = knex => Promise.resolve()
|
|||
|
||||
table.date('date_of_birth');
|
||||
table.date('date_of_death');
|
||||
table.integer('age', 3);
|
||||
|
||||
table.text('gender', 18);
|
||||
table.text('description');
|
||||
|
@ -331,6 +332,7 @@ exports.up = knex => Promise.resolve()
|
|||
|
||||
table.date('date_of_birth');
|
||||
table.date('date_of_death');
|
||||
table.integer('age', 3);
|
||||
|
||||
table.text('description');
|
||||
table.text('description_hash');
|
||||
|
|
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 5.5 MiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 3.0 MiB |
After Width: | Height: | Size: 3.9 MiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 363 KiB |
After Width: | Height: | Size: 355 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 183 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.7 MiB |
After Width: | Height: | Size: 8.8 MiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 MiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 588 KiB |
After Width: | Height: | Size: 636 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 591 KiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 761 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 1.4 MiB |
After Width: | Height: | Size: 1.5 MiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 4.8 MiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 3.1 MiB |
After Width: | Height: | Size: 30 KiB |
|
@ -637,6 +637,11 @@ const tags = [
|
|||
name: 'nipple clamps',
|
||||
slug: 'nipple-clamps',
|
||||
},
|
||||
{
|
||||
name: 'nun',
|
||||
slug: 'nun',
|
||||
group: 'roleplay',
|
||||
},
|
||||
{
|
||||
name: 'oil',
|
||||
slug: 'oil',
|
||||
|
|
|
@ -601,7 +601,7 @@ const tagPosters = [
|
|||
['blindfold', 0, 'Kylie Page in "Natural Blindfolded Beauties" for Hustler'],
|
||||
['blonde', 1, 'Marsha May in "Once You Go Black 7" for Jules Jordan'],
|
||||
['blowbang', 0, 'Lacy Lennon in "Lacy Lennon\'s First Blowbang" for HardX'],
|
||||
['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'],
|
||||
['blowjob', 1, 'Kylie Page in "Stepsis Gives Soapy Handjob In Shower" for Spy Fam'],
|
||||
['brunette', 0, 'Darcie Dolce for Playboy'],
|
||||
['bondage', 0, 'Veronica Leal for Her Limit'],
|
||||
['bukkake', 0, 'Jaye Summers in "Facialized 5" for HardX'],
|
||||
|
@ -636,14 +636,16 @@ const tagPosters = [
|
|||
['gaping', 1, 'Vina Sky in "Vina Sky Does Anal" for HardX'],
|
||||
['indian', 0, 'Resha in "Casting Resha" for Watch 4 Beauty'],
|
||||
['interracial', 1, 'Caprice and Valerie in "Sexual Attraction" for Hegre'],
|
||||
['latex', 0, 'Bianca Beauchamp in "Cherry Nun" for Latex Lair'],
|
||||
['latina', 3, 'Gina Valentina for Brazzers'],
|
||||
['lesbian', 0, 'Jenna Sativa and Alina Lopez in "Opposites Attract" for Girl Girl'],
|
||||
['maid', 0, 'Whitney Wright in "Dredd Up Your Ass 2" for Jules Jordan'],
|
||||
['milf', 1, 'Francesca Le for Evil Angel'],
|
||||
['mff', 1, 'Anikka Albrite, Kelsi Monroe and Mick Blue for HardX'],
|
||||
['mfm', 0, 'Vina Sky in "Jules Jordan\'s Three Ways" for Jules Jordan'],
|
||||
['natural-boobs', 4, 'Miela (Marry Queen) in "Pure" for FemJoy'],
|
||||
['natural-boobs', 1, 'Nia Nacci for First Class POV'],
|
||||
['nurse', 1, 'Mia Malkova in "Always Think Happy Thoughts" for Brazzers'],
|
||||
['nun', 0, 'Lady Zee in LegalPorno NF053'],
|
||||
['oil', 2, 'Jade Kush for Passion HD'],
|
||||
['oral-creampie', 1, 'Valentina Nappi for Her Limit'],
|
||||
['orgy', 1, 'Megan Rain (DP), Morgan Lee (anal), Jessa Rhodes, Melissa Moore and Kimmy Granger in "Orgy Masters 8" for Jules Jordan'],
|
||||
|
@ -658,6 +660,7 @@ const tagPosters = [
|
|||
['tattoos', 1, 'Joanna Angel for Joanna Angel'],
|
||||
['teen', 0, 'Alexa Flexy for Sensual Girl'],
|
||||
['titty-fucking', 0, 'Kylie Page in "Stepsis Gives Soapy Handjob In Shower" for Spy Fam'],
|
||||
['toys', 1, 'Chloe Lamour in "Curives In All The Right Places" for Wet and Puffy'],
|
||||
['toy-anal', 1, 'Nina North and Cassidy Klein in "Nina\'s First Lesbian Anal" for LesbianX'],
|
||||
['toy-dp', 1, 'Krissy Lynn and London River in "Lesbian DP Workout" for LesbianX'],
|
||||
['trainbang', 'poster', 'Kali Roses in "Passing Me Around" for Blacked'],
|
||||
|
@ -710,9 +713,9 @@ const tagPhotos = [
|
|||
['blonde', 3, 'Kylie Page in "A Juicy Afternoon Delight" for New Sensations'],
|
||||
['blonde', 2, 'Isabelle Deltore for Her Limit'],
|
||||
['blowbang', 'poster', 'Marsha May in "Feeding Frenzy 12" for Jules Jordan'],
|
||||
['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'],
|
||||
['blowjob', 3, 'Rose Valie for Hands On Hardcore'],
|
||||
['blowjob', 2, 'Luna Kitsuen in "Gag Reflex" for Evil Angel'],
|
||||
['blowjob', 1, 'Kylie Page in "Stepsis Gives Soapy Handjob In Shower" for Spy Fam'],
|
||||
// ['bukkake', 'poster', 'Mia Malkova in "Facialized 2" for HardX'],
|
||||
['caucasian', 0, 'Remy Lacroix for HardX'],
|
||||
['caucasian', 1, 'Sheena Shaw for Brazzers'],
|
||||
|
@ -797,11 +800,13 @@ const tagPhotos = [
|
|||
['fake-boobs', 1, 'Lela Star in "Thick" for Jules Jordan'],
|
||||
['fake-boobs', 16, 'Marsha May in "Once You Go Black 7" for Jules Jordan'],
|
||||
['fake-boobs', 9, 'Putri Cinta for Watch 4 Beauty'],
|
||||
['fake-boobs', 10, 'Tia Cyrus in "Titty-Fucked Yoga Goddess" for Latina Sex Tapes'],
|
||||
['fake-boobs', 11, 'Jessa Rhodes and Cali Carter in "Busty Anal Workout" for LesbianX'],
|
||||
['fake-boobs', 3, 'Ashly Anderson for Passion HD'],
|
||||
['fake-boobs', 10, 'Tia Cyrus in "Titty-Fucked Yoga Goddess" for Latina Sex Tapes'],
|
||||
['fake-boobs', 20, 'Chloe Lamour for DDF Busty'],
|
||||
['fake-boobs', 11, 'Jessa Rhodes and Cali Carter in "Busty Anal Workout" for LesbianX'],
|
||||
['fake-boobs', 13, 'Kitana Lure for Asshole Fever'],
|
||||
['fake-boobs', 8, 'Amber Alena for Score'],
|
||||
['fake-boobs', 19, 'Kerrie Lee in "Bricked" for Studio 66 TV'],
|
||||
['fake-boobs', 4, 'Capri Cavanni for Big Tits in Sports'],
|
||||
['fake-boobs', 15, 'Amber Jade and Karma Rx in "Amber In The Hills: Part 1" for Brazzers'],
|
||||
// ['fake-boobs', 6, 'Cathy Heaven in "Heavenly Ass" for Big Wett Butts'],
|
||||
|
@ -829,10 +834,14 @@ const tagPhotos = [
|
|||
['mfm', 7, 'Rose Valerie for Euro Sex Parties'],
|
||||
['mfm', 1, 'Lana Rhoades in "Gangbang Me 3" for HardX'],
|
||||
['mfm', 6, 'Honey Gold in "Slut Puppies 12" for Jules Jordan'],
|
||||
['natural-boobs', 1, 'Nia Nacci for First Class POV'],
|
||||
['natural-boobs', 4, 'Miela (Marry Queen) in "Pure" for FemJoy'],
|
||||
['natural-boobs', 3, 'Violet Starr in "Violet Starr 1st Lesbian Anal" for LesbianX'],
|
||||
['natural-boobs', 0, 'Valentina Nappi in "Hypnotic Curves" for LesbianX'],
|
||||
['natural-boobs', 5, 'Chloe B in "Lamour" for Met-Art'],
|
||||
['natural-boobs', 2, 'Kylie Page for All Girl Massage'],
|
||||
['nun', 1, 'Penny Pax and Darcie Dolce in "Confessions Of A Sinful Nun" for Sweetheart Video'],
|
||||
['nun', 3, 'Higurashi Rin in "Naughty Nun" for All Gravure'],
|
||||
['nun', 2, 'Lea Lexis in "Confessions Of A Sinful Nun" for Sweetheart Video'],
|
||||
['nurse', 0, 'Sarah Vandella in "Cum For Nurse Sarah" for Brazzers'],
|
||||
['oil', 1, 'Kissa Sins in "Oil Overload 14" for JulesJordan'],
|
||||
['oil', 3, 'Vina Sky for Lubed'],
|
||||
|
@ -855,6 +864,7 @@ const tagPhotos = [
|
|||
['trainbang', 0, 'Nicole Black in GIO971 for LegalPorno'],
|
||||
['tap', 1, 'Natasha Teen in SZ2098 for LegalPorno'],
|
||||
['tap', 2, 'Kira Thorn in GIO1018 for LegalPorno'],
|
||||
['titty-fucking', 1, 'Chloe Lamour for DDF Busty'],
|
||||
['toy-anal', 3, 'Kelly and Leona in "Sleeping Over" for Lez Cuties'],
|
||||
['toy-anal', 2, 'Denise, Irina and Laki in "Sexy Slumber" for Lez Cuties'],
|
||||
['toy-anal', 0, 'Kira Noir in 1225 for InTheCrack'],
|
||||
|
|
|
@ -105,6 +105,10 @@ function getMostFrequentDate(dates) {
|
|||
return moment({ year, month, date }).toDate();
|
||||
}
|
||||
|
||||
function getHighest(items) {
|
||||
return items.reduce((prevItem, item) => (item > prevItem ? item : prevItem), 0);
|
||||
}
|
||||
|
||||
function getLongest(items) {
|
||||
return items.sort((itemA, itemB) => itemB.length - itemA.length)[0] || null;
|
||||
}
|
||||
|
@ -161,6 +165,7 @@ function curateActor(actor, withDetails = false, isProfile = false) {
|
|||
entityId: actor.entity_id,
|
||||
aliasFor: actor.alias_for,
|
||||
dateOfBirth: actor.date_of_birth,
|
||||
age: actor.age,
|
||||
birthCountry: actor.birth_country_alpha2,
|
||||
...(withDetails && {
|
||||
alias: actor.alias && {
|
||||
|
@ -250,6 +255,7 @@ function curateProfileEntry(profile) {
|
|||
entity_id: profile.entity?.id || null,
|
||||
date_of_birth: profile.dateOfBirth,
|
||||
date_of_death: profile.dateOfDeath,
|
||||
age: profile.age,
|
||||
url: profile.url,
|
||||
gender: profile.gender,
|
||||
ethnicity: profile.ethnicity,
|
||||
|
@ -328,6 +334,7 @@ async function curateProfile(profile) {
|
|||
|| null;
|
||||
|
||||
curatedProfile.dateOfDeath = Number.isNaN(Number(profile.dateOfDeath)) ? null : profile.dateOfDeath;
|
||||
curatedProfile.age = Number(profile.age) || null;
|
||||
|
||||
curatedProfile.height = Number(profile.height) || profile.height?.match?.(/\d+/)?.[0] || null;
|
||||
curatedProfile.weight = Number(profile.weight) || profile.weight?.match?.(/\d+/)?.[0] || null;
|
||||
|
@ -396,7 +403,7 @@ async function curateProfile(profile) {
|
|||
}).filter(Boolean)
|
||||
: [];
|
||||
|
||||
curatedProfile.releases = toBaseReleases(profile.releases, profile.entity);
|
||||
curatedProfile.scenes = toBaseReleases(profile.scenes || profile.releases, profile.entity);
|
||||
|
||||
if (profile.ethnicity && !curatedProfile.ethnicity) logger.warn(`Unrecognized ethnicity returned by '${profile.entity.name}' scraper: ${profile.ethnicity}`);
|
||||
if ((profile.hairColor || profile.hair) && !curatedProfile.hairColor) logger.warn(`Unrecognized hair color returned by '${profile.entity.name}' scraper: ${profile.hairColor || profile.hair}`);
|
||||
|
@ -483,6 +490,7 @@ async function interpolateProfiles(actorIds) {
|
|||
|
||||
profile.date_of_birth = getMostFrequentDate(valuesByProperty.date_of_birth);
|
||||
profile.date_of_death = getMostFrequentDate(valuesByProperty.date_of_death);
|
||||
profile.age = getHighest(valuesByProperty.age);
|
||||
|
||||
// ensure most frequent country, city and state match up
|
||||
profile.birth_country_alpha2 = getMostFrequent(valuesByProperty.origin.map(location => location.country));
|
||||
|
@ -666,10 +674,13 @@ async function scrapeActors(argNames) {
|
|||
|
||||
const [entities, existingActorEntries] = await Promise.all([
|
||||
knex('entities')
|
||||
.select(knex.raw('entities.*, row_to_json(parents) as parent'))
|
||||
.select(knex.raw('entities.*, row_to_json(parents) as parent, json_agg(children) as children'))
|
||||
.whereIn('entities.slug', entitySlugs)
|
||||
.whereIn('entities.type', ['network', 'channel'])
|
||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||
.orderBy('entities.type'),
|
||||
.leftJoin('entities as children', 'children.parent_id', 'entities.id')
|
||||
.orderBy('entities.type')
|
||||
.groupBy('entities.id', 'parents.id'),
|
||||
knex('actors')
|
||||
.select(['id', 'name', 'slug', 'entry_id'])
|
||||
.whereIn('slug', baseActors.map(baseActor => baseActor.slug))
|
||||
|
|
|
@ -49,7 +49,7 @@ async function init() {
|
|||
const actorNames = (argv.actors || []).concat(actorsFromFile || []);
|
||||
|
||||
const actors = (argv.actors || argv.actorsUpdate || argv.actorsFile) && await scrapeActors(actorNames);
|
||||
const actorBaseScenes = argv.actors && argv.actorScenes && actors.map(actor => actor.releases).flat().filter(Boolean);
|
||||
const actorBaseScenes = argv.actors && argv.actorScenes && actors.map(actor => actor.scenes).flat().filter(Boolean);
|
||||
|
||||
const updateBaseScenes = (argv.latest || argv.upcoming || argv.channels || argv.networks || argv.movies) && await fetchUpdates();
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@ const qu = require('../utils/qu');
|
|||
const slugify = require('../utils/slugify');
|
||||
|
||||
function matchChannel(release, channel) {
|
||||
const series = channel.children || channel.parent.children;
|
||||
const series = channel.children || channel.parent?.children;
|
||||
|
||||
if (!series) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const serieNames = series.reduce((acc, serie) => ({
|
||||
...acc,
|
||||
|
@ -26,7 +30,7 @@ function matchChannel(release, channel) {
|
|||
|
||||
if (serie) {
|
||||
return {
|
||||
slug: serie.slug,
|
||||
channel: serie.slug,
|
||||
title: release.title.replace(new RegExp(`(${serieName}|${serie.name}|${serie.slug})\\s*[-–:/]+\\s*`, 'ig'), ''),
|
||||
};
|
||||
}
|
||||
|
@ -109,31 +113,34 @@ async function scrapeScene({ query }, url, channel, include) {
|
|||
release.photos = await fetchPhotos(query.url('.vid_buttons a[href*="project/"]'));
|
||||
}
|
||||
|
||||
release.trailer = {
|
||||
src: query.video(),
|
||||
type: query.video('source', 'type'),
|
||||
quality: query.video('source', 'data-res'),
|
||||
referer: url,
|
||||
};
|
||||
|
||||
return {
|
||||
...release,
|
||||
...matchChannel(release, channel),
|
||||
};
|
||||
}
|
||||
|
||||
function scrapeProfile({ query }, url) {
|
||||
const profile = {};
|
||||
function scrapeProfile({ query, el }, { url, gender }, baseActor, entity) {
|
||||
const profile = { url, gender };
|
||||
|
||||
const bio = query.cnts('div p').reduce((acc, item) => {
|
||||
const [key, value] = item.split(/\s*:\s*/);
|
||||
profile.age = query.number('div:nth-child(2) > p');
|
||||
profile.birthPlace = query.cnt('div:nth-child(3) > p')?.match(/nationality[\s:]+(\w+)/i)?.[1];
|
||||
|
||||
return {
|
||||
...acc,
|
||||
[slugify(key, '_')]: value.trim(),
|
||||
};
|
||||
}, {});
|
||||
profile.description = query.cnt('div:nth-child(4) > p');
|
||||
|
||||
profile.avatar = {
|
||||
src: query.img('.model-page'),
|
||||
referer: url,
|
||||
};
|
||||
|
||||
console.log(bio);
|
||||
console.log(profile);
|
||||
profile.scenes = scrapeAll(qu.initAll(el, '.project_category-videos'), entity);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
@ -160,12 +167,16 @@ async function fetchScene(url, channel, baseRelease, include) {
|
|||
return res.status;
|
||||
}
|
||||
|
||||
async function getActorUrl(baseActor) {
|
||||
async function getActorUrl(baseActor, gender = 'female') {
|
||||
if (baseActor.url) {
|
||||
return baseActor.url;
|
||||
}
|
||||
|
||||
const overviewRes = await qu.getAll('https://www.littlecaprice-dreams.com/pornstars', '.models');
|
||||
const overviewUrl = gender === 'female'
|
||||
? 'https://www.littlecaprice-dreams.com/pornstars/'
|
||||
: 'https://www.littlecaprice-dreams.com/male-models-pornstars/';
|
||||
|
||||
const overviewRes = await qu.getAll(overviewUrl, '.models');
|
||||
|
||||
if (!overviewRes.ok) {
|
||||
return overviewRes.status;
|
||||
|
@ -174,23 +185,36 @@ async function getActorUrl(baseActor) {
|
|||
const actorItem = overviewRes.items.find(({ query }) => slugify(query.q('img', 'title')) === baseActor.slug);
|
||||
|
||||
if (!actorItem) {
|
||||
if (gender === 'female') {
|
||||
return getActorUrl(baseActor, 'male');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return actorItem.query.url('a');
|
||||
const actorUrl = actorItem.query.url('a');
|
||||
|
||||
if (actorUrl) {
|
||||
return {
|
||||
url: actorUrl,
|
||||
gender,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchProfile(baseActor, entity) {
|
||||
async function fetchProfile(baseActor, { entity }) {
|
||||
const actorUrl = await getActorUrl(baseActor);
|
||||
|
||||
if (!actorUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const actorRes = await qu.get(actorUrl, '#main-content');
|
||||
const actorRes = await qu.get(actorUrl.url, '#main-content');
|
||||
|
||||
if (actorRes.ok) {
|
||||
return scrapeProfile(actorRes.item, actorUrl, entity);
|
||||
return scrapeProfile(actorRes.item, actorUrl, baseActor, entity);
|
||||
}
|
||||
|
||||
return actorRes.status;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const knex = require('../knex');
|
||||
const logger = require('../logger')(__filename);
|
||||
const http = require('./http');
|
||||
|
||||
|
@ -8,6 +9,20 @@ async function resolvePlace(query) {
|
|||
return null;
|
||||
}
|
||||
|
||||
// query is a nationality, lookup would get weird results (British resolves to British, Northern Ireland)
|
||||
const country = await knex('countries')
|
||||
.where('nationality', 'ilike', `%${query}%`)
|
||||
.orWhere('alpha3', 'ilike', `%${query}%`)
|
||||
.orWhere('alpha2', 'ilike', `%${query}%`)
|
||||
.orderBy('priority', 'desc')
|
||||
.first();
|
||||
|
||||
if (country) {
|
||||
return {
|
||||
country: country.alpha2,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
// https://operations.osmfoundation.org/policies/nominatim/
|
||||
const res = await http.get(`https://nominatim.openstreetmap.org/search/${encodeURI(query)}?format=json&accept-language=en&addressdetails=1`, {
|
||||
|
|
|
@ -12,7 +12,7 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
|||
}
|
||||
|
||||
extend type Actor {
|
||||
age: Int @requires(columns: ["dateOfBirth"])
|
||||
ageFromBirth: Int @requires(columns: ["dateOfBirth"])
|
||||
ageAtDeath: Int @requires(columns: ["dateOfBirth", "dateOfDeath"])
|
||||
height(units:Units): String @requires(columns: ["height"])
|
||||
weight(units:Units): String @requires(columns: ["weight"])
|
||||
|
@ -22,7 +22,7 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
|||
`,
|
||||
resolvers: {
|
||||
Actor: {
|
||||
age(parent, _args, _context, _info) {
|
||||
ageFromBirth(parent, _args, _context, _info) {
|
||||
if (!parent.dateOfBirth) return null;
|
||||
|
||||
return moment().diff(parent.dateOfBirth, 'years');
|
||||
|
|