Checking nationality against alpha2 and alpha2. Improved Team Skeet profile scraper.
This commit is contained in:
parent
23e4f87af0
commit
747c2e1637
|
@ -332,13 +332,17 @@ async function curateProfile(profile) {
|
||||||
if (!curatedProfile.placeOfBirth && curatedProfile.nationality) {
|
if (!curatedProfile.placeOfBirth && curatedProfile.nationality) {
|
||||||
const country = await knex('countries')
|
const country = await knex('countries')
|
||||||
.where('nationality', 'ilike', `%${curatedProfile.nationality}%`)
|
.where('nationality', 'ilike', `%${curatedProfile.nationality}%`)
|
||||||
|
.orWhere('alpha3', 'ilike', `%${curatedProfile.nationality}%`)
|
||||||
|
.orWhere('alpha2', 'ilike', `%${curatedProfile.nationality}%`)
|
||||||
.orderBy('priority', 'desc')
|
.orderBy('priority', 'desc')
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
|
if (country) {
|
||||||
curatedProfile.placeOfBirth = {
|
curatedProfile.placeOfBirth = {
|
||||||
country: country.alpha2,
|
country: country.alpha2,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
curatedProfile.social = Array.isArray(profile.social)
|
curatedProfile.social = Array.isArray(profile.social)
|
||||||
? profile.social.map((social) => {
|
? profile.social.map((social) => {
|
||||||
|
|
|
@ -67,7 +67,8 @@ function scrapeScene(scene) {
|
||||||
function scrapeProfile(actor) {
|
function scrapeProfile(actor) {
|
||||||
const profile = {};
|
const profile = {};
|
||||||
|
|
||||||
if (actor.bio.about) {
|
// TODO: split bio https://store.psmcdn.net/ts-organic-iiiokv9kyo/modelsContent/valerie-white.json
|
||||||
|
if (actor.bio.about && !/\band\b/.test(actor.bio.about)) {
|
||||||
// birthdate seems never/rarely correct
|
// birthdate seems never/rarely correct
|
||||||
const measurements = actor.bio.about.match(/Measurements: (\d+)(\w+)-(\d+)-(\d+)/i);
|
const measurements = actor.bio.about.match(/Measurements: (\d+)(\w+)-(\d+)-(\d+)/i);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue