From e7b98afdbedacfc42e11af895724c83edbc5a3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Mon, 7 Jul 2025 17:03:36 -0700 Subject: [PATCH] refactor(subscription): avoid using Sprintf to construct Youtube playlist feed URL --- internal/reader/subscription/finder.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/reader/subscription/finder.go b/internal/reader/subscription/finder.go index 3fbde0fa..b8e871c8 100644 --- a/internal/reader/subscription/finder.go +++ b/internal/reader/subscription/finder.go @@ -5,7 +5,6 @@ package subscription // import "miniflux.app/v2/internal/reader/subscription" import ( "bytes" - "fmt" "io" "log/slog" "net/url" @@ -295,8 +294,8 @@ func (f *SubscriptionFinder) FindSubscriptionsFromYouTubeChannelPage(websiteURL return nil, nil } - if _, after, found := strings.Cut(decodedUrl.Path, "channel/"); found { - feedURL := "https://www.youtube.com/feeds/videos.xml?channel_id=" + after + if _, channelID, found := strings.Cut(decodedUrl.Path, "channel/"); found { + feedURL := "https://www.youtube.com/feeds/videos.xml?channel_id=" + channelID return Subscriptions{NewSubscription(websiteURL, feedURL, parser.FormatAtom)}, nil } @@ -316,7 +315,7 @@ func (f *SubscriptionFinder) FindSubscriptionsFromYouTubePlaylistPage(websiteURL if (strings.HasPrefix(decodedUrl.Path, "/watch") && decodedUrl.Query().Has("list")) || strings.HasPrefix(decodedUrl.Path, "/playlist") { playlistID := decodedUrl.Query().Get("list") - feedURL := fmt.Sprintf(`https://www.youtube.com/feeds/videos.xml?playlist_id=%s`, playlistID) + feedURL := "https://www.youtube.com/feeds/videos.xml?playlist_id=" + playlistID return Subscriptions{NewSubscription(websiteURL, feedURL, parser.FormatAtom)}, nil }