diff --git a/lib/index.js b/lib/index.js index 32eee41..afc1e13 100644 --- a/lib/index.js +++ b/lib/index.js @@ -122,7 +122,9 @@ async function getArtistOrLabelInfo(artistOrLabelUrl, options = {}) { artistOrLabelUrl, imageFormat: await _parseImageFormatArg(options.imageFormat) }; - return fetch(artistOrLabelUrl) + // Some pages don't actually show the 'bio' column. + // The /music page does seem to always show it though, so parse from that. + return fetch(utils.getUrl('music', artistOrLabelUrl)) .then( res => res.text() ) .then( html => parser.parseArtistOrLabelInfo(html, opts) ); } diff --git a/lib/parser.js b/lib/parser.js index f2d0e3f..5bddc27 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -328,20 +328,25 @@ function parseArtistOrLabelInfo(html, opts) { const $ = cheerio.load(html); let bioText = $('#bio-text'); - let bioTextMore = bioText.find('.peekaboo-text'); let description; - if (bioTextMore.length) { - bioTextMore.find('.lightweightBreak').remove(); - bioText.find('.peekaboo-text, .peekaboo-link').remove(); - description = (bioText.html().trim() + ' ' + bioTextMore.html()).trim(); + if (bioText.length) { + let bioTextMore = bioText.find('.peekaboo-text'); + if (bioTextMore.length) { + bioTextMore.find('.lightweightBreak').remove(); + bioText.find('.peekaboo-text, .peekaboo-link').remove(); + description = (bioText.html().trim() + ' ' + bioTextMore.html()).trim(); + } + else { + description = bioText.html().trim(); + } + description = utils.stripLineBreaks(description); + description = utils.brToNewLine(description); + description = utils.stripTags(description); + description = decode(description); } else { - description = bioText.html().trim(); + description = ''; } - description = utils.stripLineBreaks(description); - description = utils.brToNewLine(description); - description = utils.stripTags(description); - description = decode(description); let isLabel = $('a[href="/artists"]').length; let label = null;