ParseRSS: accept any file with audio/ media type as podcast

There are some podcasts that use audio/opus files (mostly as an alternative,
but still), which makes the audio attachment not being displayed.

Instead of increasing the list of allowed formats (because audio/mp3 would be
quite useful on the list too), I guess it'd be better to give any audio/ media
type to the user-agent and let him worry about it. :^)
This commit is contained in:
Karol Kosek
2021-06-22 14:29:40 +02:00
committed by nkanaev
parent d575acfe80
commit 19ecfcd0bc
2 changed files with 21 additions and 1 deletions

View File

@@ -136,6 +136,26 @@ func TestRSSPodcast(t *testing.T) {
}
}
func TestRSSOpusPodcast(t *testing.T) {
feed, _ := Parse(strings.NewReader(`
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<item>
<enclosure length="100500" type="audio/opus" url="http://example.com/audio.ext"/>
</item>
</channel>
</rss>
`))
have := feed.Items[0].AudioURL
want := "http://example.com/audio.ext"
if want != have {
t.Logf("want: %#v", want)
t.Logf("have: %#v", have)
t.FailNow()
}
}
// found in: https://podcast.cscript.site/podcast.xml
func TestRSSPodcastDuplicated(t *testing.T) {
feed, _ := Parse(strings.NewReader(`