parseAlbumInfo(): handle missing properties

This commit is contained in:
patrickkfkan 2021-01-21 02:01:45 +08:00
parent 1b389fe823
commit 31079ddef0

View File

@ -161,7 +161,7 @@ function parseAlbumInfo(html, opts) {
name: release.name, name: release.name,
url: release.url, url: release.url,
format: release.musicReleaseFormat, format: release.musicReleaseFormat,
description: release.description, description: release.description || '',
imageUrl: utils.reformatImageUrl(release.image, opts.albumImageFormat) imageUrl: utils.reformatImageUrl(release.image, opts.albumImageFormat)
}); });
}); });
@ -172,7 +172,7 @@ function parseAlbumInfo(html, opts) {
if (Array.isArray(extra.trackinfo)) { if (Array.isArray(extra.trackinfo)) {
extra.trackinfo.every( track => { extra.trackinfo.every( track => {
if (url.endsWith(track.title_link)) { if (url.endsWith(track.title_link)) {
file = track.file['mp3-128']; file = track.file && track.file['mp3-128'] ? track.file['mp3-128'] : null;
return false; return false;
} }
return true; return true;