Checking nationality against alpha2 and alpha2. Improved Team Skeet profile scraper.

This commit is contained in:
DebaucheryLibrarian 2020-07-23 04:39:12 +02:00
parent 23e4f87af0
commit 747c2e1637
2 changed files with 10 additions and 5 deletions

View File

@ -332,13 +332,17 @@ async function curateProfile(profile) {
if (!curatedProfile.placeOfBirth && curatedProfile.nationality) {
const country = await knex('countries')
.where('nationality', 'ilike', `%${curatedProfile.nationality}%`)
.orWhere('alpha3', 'ilike', `%${curatedProfile.nationality}%`)
.orWhere('alpha2', 'ilike', `%${curatedProfile.nationality}%`)
.orderBy('priority', 'desc')
.first();
if (country) {
curatedProfile.placeOfBirth = {
country: country.alpha2,
};
}
}
curatedProfile.social = Array.isArray(profile.social)
? profile.social.map((social) => {

View File

@ -67,7 +67,8 @@ function scrapeScene(scene) {
function scrapeProfile(actor) {
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
const measurements = actor.bio.about.match(/Measurements: (\d+)(\w+)-(\d+)-(\d+)/i);