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

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

View File

@@ -79,7 +79,10 @@ async function scrapeProfile(html, _url, actorName) {
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 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;