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

@@ -71,7 +71,7 @@ func ParseRSS(r io.Reader) (*Feed, error) {
for _, srcitem := range srcfeed.Items {
podcastURL := ""
for _, e := range srcitem.Enclosures {
if e.Type == "audio/mpeg" || e.Type == "audio/x-m4a" {
if strings.HasPrefix(e.Type, "audio/") {
podcastURL = e.URL
if srcitem.OrigEnclosureLink != "" && strings.Contains(podcastURL, path.Base(srcitem.OrigEnclosureLink)) {