Skip to content

Commit

Permalink
Merge pull request #3732 from Timtam/allow-mrss-item-enclosures-for-p…
Browse files Browse the repository at this point in the history
…odcasts

check for mrss item media:content when extracting item enclosures
  • Loading branch information
advplyr authored Jan 20, 2025
2 parents 24ce4a2 + bdd8e5b commit 28681d3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/utils/podcastUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,19 @@ function extractPodcastMetadata(channel) {

function extractEpisodeData(item) {
// Episode must have url
if (!item.enclosure?.[0]?.['$']?.url) {
let enclosure

if (item.enclosure?.[0]?.['$']?.url) {
enclosure = item.enclosure[0]['$']
} else if(item['media:content']?.find(c => c?.['$']?.url && (c?.['$']?.type ?? "").startsWith("audio"))) {
enclosure = item['media:content'].find(c => (c['$']?.type ?? "").startsWith("audio"))['$']
} else {
Logger.error(`[podcastUtils] Invalid podcast episode data`)
return null
}

const episode = {
enclosure: {
...item.enclosure[0]['$']
}
enclosure: enclosure,
}

episode.enclosure.url = episode.enclosure.url.trim()
Expand Down

0 comments on commit 28681d3

Please sign in to comment.