Added source maps. Fixed DDFNetwork avatar and improved photo fetch error handling.

This commit is contained in:
2019-12-10 00:30:55 +01:00
parent 04a89efa58
commit b6123b9418
9 changed files with 17 additions and 16 deletions

View File

@@ -9,7 +9,7 @@
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
"no-console": 0,
"indent": "off",
"template-curly-spacing": "off",
"max-len": [2, {"code": 300, "tabWidth": 4, "ignoreUrls": true}],
"template-curly-spacing": "off"
}
}

View File

@@ -271,8 +271,6 @@ async function updateActor(actor, scraped = false, scrapeSuccess = false) {
}
async function mergeProfiles(profiles, actor) {
console.log(profiles);
const mergedProfile = profiles.reduce((prevProfile, profile) => {
if (profile === null) {
return prevProfile;

View File

@@ -189,7 +189,7 @@ async function storePhotos(release, releaseId) {
const metaFiles = await Promise.map(newPhotos, async (photoUrl, index) => fetchPhoto(photoUrl, index, `(${release.site.name}, ${releaseId}) "${release.title}"`), {
concurrency: 10,
});
}).filter(photo => photo);
const uniquePhotos = await filterHashDuplicates(metaFiles, 'releases', 'photo', `(${release.site.name}, ${releaseId}) "${release.title}"`);
const savedPhotos = await savePhotos(uniquePhotos, release, releaseId);
@@ -244,7 +244,7 @@ async function storeAvatars(profile, actor) {
const metaFiles = await Promise.map(newPhotos, async (photoUrl, index) => fetchPhoto(photoUrl, index, actor.name), {
concurrency: 10,
});
}).filter(photo => photo);
const uniquePhotos = await filterHashDuplicates(metaFiles, 'actors', ['avatar', 'photo'], actor.name);
const [savedPhotos, avatarEntry] = await Promise.all([

View File

@@ -149,7 +149,7 @@ async function scrapeProfile(html, _url, actorName) {
if (bio['Shoe size']) profile.shoes = Number(bio['Shoe size'].split('|')[1]);
if (descriptionEl) profile.description = descriptionEl.textContent.trim();
if (avatarEl) profile.avatar = `https:${avatarEl.dataset.src}`;
if (avatarEl && avatarEl.dataset.src.match('^//')) profile.avatar = `https:${avatarEl.dataset.src}`;
return profile;
}