diff --git a/internal/feed/youtube.go b/internal/feed/youtube.go index b1489d7..65a5376 100644 --- a/internal/feed/youtube.go +++ b/internal/feed/youtube.go @@ -39,12 +39,12 @@ func parseYoutubeFeedTime(t string) time.Time { return parsedTime } -func FetchYoutubeChannelUploads(channelIds []string, videoUrlTemplate string, noShorts bool) (Videos, error) { +func FetchYoutubeChannelUploads(channelIds []string, videoUrlTemplate string, includeShorts bool) (Videos, error) { requests := make([]*http.Request, 0, len(channelIds)) for i := range channelIds { var feedUrl string - if noShorts && strings.HasPrefix(channelIds[i], "UC") { + if !includeShorts && strings.HasPrefix(channelIds[i], "UC") { playlistId := strings.Replace(channelIds[i], "UC", "UULF", 1) feedUrl = "https://www.youtube.com/feeds/videos.xml?playlist_id=" + playlistId } else { diff --git a/internal/widget/videos.go b/internal/widget/videos.go index e47db09..8943603 100644 --- a/internal/widget/videos.go +++ b/internal/widget/videos.go @@ -17,7 +17,7 @@ type Videos struct { CollapseAfterRows int `yaml:"collapse-after-rows"` Channels []string `yaml:"channels"` Limit int `yaml:"limit"` - NoShorts bool `yaml:"no_shorts"` + IncludeShorts bool `yaml:"include-shorts"` } func (widget *Videos) Initialize() error { @@ -35,7 +35,7 @@ func (widget *Videos) Initialize() error { } func (widget *Videos) Update(ctx context.Context) { - videos, err := feed.FetchYoutubeChannelUploads(widget.Channels, widget.VideoUrlTemplate, widget.NoShorts) + videos, err := feed.FetchYoutubeChannelUploads(widget.Channels, widget.VideoUrlTemplate, widget.IncludeShorts) if !widget.canContinueUpdateAfterHandlingErr(err) { return