Trim podcast descriptions #3720

This commit is contained in:
advplyr 2024-12-17 17:44:18 -06:00
parent 858d697d0f
commit 63b3f22504

View File

@ -59,8 +59,8 @@ function extractPodcastMetadata(channel) {
if (channel['description']) { if (channel['description']) {
const rawDescription = extractFirstArrayItem(channel, 'description') || '' const rawDescription = extractFirstArrayItem(channel, 'description') || ''
metadata.description = htmlSanitizer.sanitize(rawDescription) metadata.description = htmlSanitizer.sanitize(rawDescription.trim())
metadata.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription) metadata.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription.trim())
} }
const arrayFields = ['title', 'language', 'itunes:explicit', 'itunes:author', 'pubDate', 'link', 'itunes:type'] const arrayFields = ['title', 'language', 'itunes:explicit', 'itunes:author', 'pubDate', 'link', 'itunes:type']
@ -103,8 +103,8 @@ function extractEpisodeData(item) {
// Supposed to be the plaintext description but not always followed // Supposed to be the plaintext description but not always followed
if (item['description']) { if (item['description']) {
const rawDescription = extractFirstArrayItem(item, 'description') || '' const rawDescription = extractFirstArrayItem(item, 'description') || ''
if (!episode.description) episode.description = htmlSanitizer.sanitize(rawDescription) if (!episode.description) episode.description = htmlSanitizer.sanitize(rawDescription.trim())
episode.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription) episode.descriptionPlain = htmlSanitizer.stripAllTags(rawDescription.trim())
} }
if (item['pubDate']) { if (item['pubDate']) {