Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

feat: exclude members-only videos from channel fetching

Jeremy Herved6ccbdab4fa3
diff --git a/lib/youtube.js b/lib/youtube.js
index 5e95a22..e386295 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -145,6 +145,12 @@ export async function getVideosFor (channelName) {
const data = v.richItemRenderer.content.videoRenderer
if (!data) return
+ // Skip members-only videos
+ const isMembersOnly = data.badges?.some(badge =>
+ badge.metadataBadgeRenderer?.style === 'BADGE_STYLE_TYPE_MEMBERS_ONLY'
+ )
+ if (isMembersOnly) return
+
const viewCount = data.viewCountText?.simpleText || '0 views'
return {