Skip to content

Commit

Permalink
Add IsLiveBroadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
porjo committed Jun 8, 2024
1 parent 61291a4 commit 140b85d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ type Request struct {
ChannelPath string
}
type Item struct {
Title string
Description string
Duration string
PublishTime string
ThumbnailSrc string
Link string
Title string
Description string
Duration string
PublishTime string
ThumbnailSrc string
Link string
IsLiveBroadcast bool
}

func FeedHandler(c echo.Context) error {
Expand Down Expand Up @@ -132,7 +133,14 @@ func GetFeed(ctx context.Context, r Request) (*podcast.Podcast, error) {
}

item := Item{}
item.Duration = strings.TrimSpace(s.Find("div.videostream__badge").Text())
info := s.Find("div.videostream__info")
item.Duration = strings.TrimSpace(info.Find("videostream__status--duration").Text())
live := info.Find("videostream__status--live")

// AFAIK there is no way to flag a podcast as live in iTunes RSS, but may be handy in future
if live != nil {
item.IsLiveBroadcast = true
}

item.Title = strings.TrimSpace(s.Find("h3.thumbnail__title").Text())
if item.Title == "" {
Expand Down

0 comments on commit 140b85d

Please sign in to comment.