Improved profile scrapers. Sorting avatars on actor page by index.

This commit is contained in:
ThePendulum 2019-11-21 04:24:55 +01:00
parent 9224b441e2
commit 31a8f1cac1
4 changed files with 13 additions and 3 deletions

View File

@ -75,6 +75,11 @@
<dfn class="bio-heading">Measurements</dfn> <dfn class="bio-heading">Measurements</dfn>
<span>{{ actor.bust || '??' }}-{{ actor.waist || '??' }}-{{ actor.hip || '??' }}</span> <span>{{ actor.bust || '??' }}-{{ actor.waist || '??' }}-{{ actor.hip || '??' }}</span>
</li> </li>
<li v-if="actor.social && actor.social.length > 0">
<dfn class="bio-heading">Social</dfn>
<span v-for="social in actor.social">{{ social }}</span>
</li>
</ul> </ul>
<span class="description">{{ actor.description }}</span> <span class="description">{{ actor.description }}</span>

View File

@ -11,7 +11,9 @@ const { createActorMediaDirectory, storeAvatars } = require('./media');
async function curateActor(actor) { async function curateActor(actor) {
const [aliases, avatars] = await Promise.all([ const [aliases, avatars] = await Promise.all([
knex('actors').where({ alias_for: actor.id }), knex('actors').where({ alias_for: actor.id }),
knex('media').where({ domain: 'actors', target_id: actor.id }), knex('media')
.where({ domain: 'actors', target_id: actor.id })
.orderBy('index'),
]); ]);
return { return {

View File

@ -148,7 +148,7 @@ function scrapeProfile(html, url, actorName) {
}; };
if (bio.Ethnicity) profile.ethnicity = bio.Ethnicity; if (bio.Ethnicity) profile.ethnicity = bio.Ethnicity;
if (bio.Measurements) [profile.bust, profile.waist, profile.hip] = bio.Measurements.split('-'); if (bio.Measurements && bio.Measurements.match(/\w+-\d+-\d+/)) [profile.bust, profile.waist, profile.hip] = bio.Measurements.split('-');
if (bio['Date of Birth'] && bio['Date of Birth'] !== 'Unknown') profile.birthdate = moment.utc(bio['Date of Birth'], 'MMMM DD, YYYY').toDate(); if (bio['Date of Birth'] && bio['Date of Birth'] !== 'Unknown') profile.birthdate = moment.utc(bio['Date of Birth'], 'MMMM DD, YYYY').toDate();
if (bio['Birth Location']) profile.birthPlace = bio['Birth Location']; if (bio['Birth Location']) profile.birthPlace = bio['Birth Location'];
if (bio['Pussy Type']) profile.pussy = bio['Pussy Type'].split(',').slice(-1)[0].toLowerCase(); if (bio['Pussy Type']) profile.pussy = bio['Pussy Type'].split(',').slice(-1)[0].toLowerCase();

View File

@ -79,7 +79,10 @@ async function scrapeProfile(html, _url, actorName) {
const avatarEl = document.querySelector('.model--avatar img[src^="http"]'); const avatarEl = document.querySelector('.model--avatar img[src^="http"]');
const entries = Array.from(document.querySelectorAll('.model--description tr'), el => el.textContent.replace(/\n/g, '').split(':')); const entries = Array.from(document.querySelectorAll('.model--description tr'), el => el.textContent.replace(/\n/g, '').split(':'));
const bio = entries.reduce((acc, [key, value]) => ({ ...acc, [key.trim()]: value.trim() }), {});
const bio = entries
.filter(entry => entry.length === 2) // ignore entries without ':' (About section, see Blanche Bradburry)
.reduce((acc, [key, value]) => ({ ...acc, [key.trim()]: value.trim() }), {});
const birthCountryName = bio.Nationality; const birthCountryName = bio.Nationality;