Skip to content

Commit 88f9f27

Browse files
mtsz-plfguillot
authored andcommitted
feat(finder): generate feeds for stable youtube playlists
1 parent dc1653b commit 88f9f27

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

internal/reader/subscription/finder.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (f *subscriptionFinder) FindSubscriptions(websiteURL, rssBridgeURL string,
6868
f.feedDownloaded = true
6969
return Subscriptions{NewSubscription(responseHandler.EffectiveURL(), responseHandler.EffectiveURL(), feedFormat)}, nil
7070
}
71-
71+
7272
// Step 2) Find the canonical URL of the website.
7373
slog.Debug("Try to find the canonical URL of the website", slog.String("website_url", websiteURL))
7474
websiteURL = f.findCanonicalURL(websiteURL, responseHandler.ContentType(), bytes.NewReader(responseBody))
@@ -285,15 +285,6 @@ func (f *subscriptionFinder) findSubscriptionsFromYouTube(websiteURL string) (Su
285285
{"UULF", "Videos"},
286286
{"UUSH", "Short videos"},
287287
{"UULV", "Live streams"},
288-
289-
{"UULP", "Popular videos"},
290-
{"UUPS", "Popular short videos"},
291-
{"UUPV", "Popular live streams"},
292-
293-
{"UUMO", "Members-only contents (videos, short videos and live streams)"},
294-
{"UUMF", "Members-only videos"},
295-
{"UUMS", "Members-only short videos"},
296-
{"UUMV", "Members-only live streams"},
297288
}
298289

299290
decodedURL, err := url.Parse(websiteURL)
@@ -308,15 +299,15 @@ func (f *subscriptionFinder) findSubscriptionsFromYouTube(websiteURL string) (Su
308299

309300
if _, baseID, found := strings.Cut(decodedURL.Path, "channel/UC"); found {
310301
var subscriptions Subscriptions
311-
302+
312303
channelFeedURL := "https://www.youtube.com/feeds/videos.xml?channel_id=UC" + baseID
313304
subscriptions = append(subscriptions, NewSubscription("Channel", channelFeedURL, parser.FormatAtom))
314-
305+
315306
for _, playlist := range playlistPrefixes {
316307
playlistFeedURL := "https://www.youtube.com/feeds/videos.xml?playlist_id=" + playlist.prefix + baseID
317308
subscriptions = append(subscriptions, NewSubscription(playlist.title, playlistFeedURL, parser.FormatAtom))
318309
}
319-
310+
320311
return subscriptions, nil
321312
}
322313

internal/reader/subscription/finder_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ func TestFindYoutubeFeed(t *testing.T) {
3939
"https://www.youtube.com/feeds/videos.xml?playlist_id=UULF-Qj80avWItNRjkZ41rzHyw",
4040
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUSH-Qj80avWItNRjkZ41rzHyw",
4141
"https://www.youtube.com/feeds/videos.xml?playlist_id=UULV-Qj80avWItNRjkZ41rzHyw",
42-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UULP-Qj80avWItNRjkZ41rzHyw",
43-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUPS-Qj80avWItNRjkZ41rzHyw",
44-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUPV-Qj80avWItNRjkZ41rzHyw",
45-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUMO-Qj80avWItNRjkZ41rzHyw",
46-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUMF-Qj80avWItNRjkZ41rzHyw",
47-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUMS-Qj80avWItNRjkZ41rzHyw",
48-
"https://www.youtube.com/feeds/videos.xml?playlist_id=UUMV-Qj80avWItNRjkZ41rzHyw",
4942
},
5043
},
5144
// Channel URL with name

0 commit comments

Comments
 (0)