Added birthday to Bang actor scraper.

This commit is contained in:
ThePendulum 2020-05-17 05:08:41 +02:00
parent f42ca7bd52
commit 61965d480c
3 changed files with 12 additions and 7 deletions

View File

@ -75,7 +75,10 @@
>
<dfn class="bio-label"><Icon icon="christian-cross" />Date of death</dfn>
<span class="birthdate">{{ formatDate(actor.dateOfDeath, 'MMMM D, YYYY') }}<span class="age">{{ actor.ageAtDeath }}</span></span>
<span class="birthdate">{{ formatDate(actor.dateOfDeath, 'MMMM D, YYYY') }}<span
v-if="actor.ageAtDeath"
class="age"
>{{ actor.ageAtDeath }}</span></span>
</li>
<li

View File

@ -152,9 +152,11 @@ async function curateProfile(profile) {
|| (/trans/i.test(profile.gender) && 'transsexual')
|| null;
curatedProfile.dateOfBirth = (!Number.isNaN(Number(profile.dateOfBirth || profile.birthdate)) // possibly valid date
&& new Date() - profile.birthdate > 567648000000 // over 18
&& profile.birthdate)
const dateOfBirth = profile.dateOfBirth || profile.birthdate;
curatedProfile.dateOfBirth = (!Number.isNaN(Number(dateOfBirth)) // possibly valid date
&& new Date() - dateOfBirth > 567648000000 // over 18
&& dateOfBirth)
|| null;
curatedProfile.dateOfDeath = Number.isNaN(Number(profile.dateOfDeath)) ? null : profile.dateOfDeath;
@ -255,8 +257,6 @@ async function interpolateProfiles(actors) {
profile.date_of_birth = getMostFrequentDate(valuesByProperty.date_of_birth);
profile.date_of_death = getMostFrequentDate(valuesByProperty.date_of_death);
console.log(valuesByProperty.date_of_birth, profile.date_of_birth);
profile.birth_city = getMostFrequent(valuesByProperty.birth_city);
profile.birth_state = getMostFrequent(valuesByProperty.birth_state);
profile.birth_country_alpha2 = getMostFrequent(valuesByProperty.birth_country_alpha2);

View File

@ -3,8 +3,9 @@
const bhttp = require('bhttp');
const { post } = require('../utils/http');
const slugify = require('../utils/slugify');
const { extractDate } = require('../utils/qu');
const { inchesToCm } = require('../utils/convert');
const slugify = require('../utils/slugify');
const clusterId = '617fb597b659459bafe6472470d9073a';
const authKey = 'YmFuZy1yZWFkOktqVDN0RzJacmQ1TFNRazI=';
@ -87,6 +88,7 @@ function scrapeProfile(actor) {
const profile = {};
profile.aliases = actor.aliases;
profile.dateOfBirth = extractDate(actor.birthDate);
profile.gender = ({ F: 'female', M: 'male' })[actor.gender];
profile.ethnicity = actor.ethnicity;