@@ -4,6 +4,7 @@ import { csvLoader } from "@ascorbic/csv-loader";
44import { airtableLoader } from "@ascorbic/airtable-loader" ;
55import { mockLoader } from "@ascorbic/mock-loader" ;
66import { authorFeedLoader } from "@ascorbic/bluesky-loader" ;
7+ import { youTubeLoader } from "@ascorbic/youtube-loader" ;
78const releases = defineCollection ( {
89 loader : feedLoader ( {
910 url : "https://github.com/withastro/astro/releases.atom" ,
@@ -74,6 +75,75 @@ const bluesky = defineCollection({
7475 } ) ,
7576} ) ;
7677
78+ // YouTube Collections - Demonstrating different loader types
79+ const youtubeVideos = defineCollection ( {
80+ loader : youTubeLoader ( {
81+ type : "videos" ,
82+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
83+ videoIds : [
84+ "dQw4w9WgXcQ" , // Rick Roll - classic
85+ "9bZkp7q19f0" , // Gangnam Style
86+ "L_jWHffIx5E" , // Smells Like Teen Spirit
87+ "fJ9rUzIMcZQ" , // Bohemian Rhapsody
88+ "hTWKbfoikeg" , // Never Gonna Give You Up (different version)
89+ ] ,
90+ } ) ,
91+ } ) ;
92+
93+ const channelVideos = defineCollection ( {
94+ loader : youTubeLoader ( {
95+ type : "channel" ,
96+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
97+ channelId : "UCrUL8K81R4VBzm-KOYwrcxQ" , // FreeCodeCamp channel
98+ maxResults : 10 ,
99+ order : "date" ,
100+ } ) ,
101+ } ) ;
102+
103+ // Search for videos about Astro
104+ const astroSearchVideos = defineCollection ( {
105+ loader : youTubeLoader ( {
106+ type : "search" ,
107+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
108+ query : "Astro web framework" ,
109+ maxResults : 15 ,
110+ order : "relevance" ,
111+ } ) ,
112+ } ) ;
113+
114+ // Channel videos ordered by view count (most popular)
115+ const popularChannelVideos = defineCollection ( {
116+ loader : youTubeLoader ( {
117+ type : "channel" ,
118+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
119+ channelId : "UCrUL8K81R4VBzm-KOYwrcxQ" , // FreeCodeCamp channel
120+ maxResults : 8 ,
121+ order : "viewCount" ,
122+ } ) ,
123+ } ) ;
124+
125+ // Search with date filter - recent videos about JavaScript
126+ const recentJavaScriptVideos = defineCollection ( {
127+ loader : youTubeLoader ( {
128+ type : "search" ,
129+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
130+ query : "JavaScript tutorial" ,
131+ maxResults : 12 ,
132+ order : "date" ,
133+ publishedAfter : new Date ( "2024-01-01" ) ,
134+ } ) ,
135+ } ) ;
136+
137+ // Playlist example - Web Development Playlist
138+ const webDevPlaylist = defineCollection ( {
139+ loader : youTubeLoader ( {
140+ type : "playlist" ,
141+ apiKey : import . meta. env . YOUTUBE_API_KEY ,
142+ playlistId : "PL8Qn4kutqAEuDiRlQ7TD2lthxTKtrbQTc" ,
143+ maxResults : 20 ,
144+ } ) ,
145+ } ) ;
146+
77147export const collections = {
78148 releases,
79149 podcasts,
@@ -82,4 +152,10 @@ export const collections = {
82152 mockBlog,
83153 mockOrders,
84154 bluesky,
155+ youtubeVideos,
156+ channelVideos,
157+ astroSearchVideos,
158+ popularChannelVideos,
159+ recentJavaScriptVideos,
160+ webDevPlaylist,
85161} ;
0 commit comments