Fixed avatars without entropy being discarded.

This commit is contained in:
DebaucheryLibrarian 2021-01-22 15:40:49 +01:00
parent 130368ca70
commit bd9b795516
2 changed files with 6 additions and 4 deletions

View File

@ -548,7 +548,7 @@ async function interpolateProfiles(actorIdsOrNames) {
profile.avatar_media_id = actorProfiles
.map(actorProfile => actorProfile.avatar)
.filter(avatar => avatar && avatar.entropy > 6)
.filter(avatar => avatar && (avatar.entropy === null || avatar.entropy > 6))
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
return profile;
@ -683,6 +683,8 @@ async function scrapeProfiles(actor, sources, entitiesBySlug, existingProfilesBy
}
}), Promise.reject(new Error()));
} catch (error) {
console.log(error);
if (error.code !== 'PROFILE_NOT_AVAILABLE') {
logger.error(`Failed to fetch profile for '${actor.name}': ${error.message}`);
}

View File

@ -19,8 +19,8 @@ function scrape(html, site) {
const sceneLinkElement = $(element).find('.thmb_lnk');
release.title = sceneLinkElement.attr('title');
release.url = site.parameters?.legacy
? `${site.url}{sceneLinkElement.attr('href')}`
release.url = site.parameters?.legacy || !site.parent
? `${site.url}${sceneLinkElement.attr('href')}`
: `${site.parent.url}${sceneLinkElement.attr('href')}`;
release.shootId = sceneLinkElement.attr('id') && sceneLinkElement.attr('id').split('-')[1];
@ -154,7 +154,7 @@ function scrapeProfile(html, scope) {
const avatar = query.q('.profilePic img', 'src');
if (avatar) profile.avatar = `https:${avatar}`;
profile.releases = scrape(html, scope.network);
profile.releases = scrape(html, scope.entity);
return profile;
}