Finish media library: live YouTube auto-pull - #24
Merged
Conversation
Server-only fetch layer that resolves a channel's uploads playlist (by handle or ID) and pulls its recent videos, cached with hourly ISR revalidation. Fails soft everywhere — no key, no channel, a bad response, or a network error all just return an empty list rather than throwing, so a YouTube outage can't take down the site.
YOUTUBE_API_KEY, YOUTUBE_CHANNEL_HANDLE, YOUTUBE_CHANNEL_ID — all optional, matching the Clerk/Supabase/Resend convention of failing soft when unset rather than breaking the build.
publishedAt will drive sort order once fetched YouTube uploads are merged in. MEDIA_ITEMS's role narrows to hand-curated entries — mainly Instagram, plus pinning a specific YouTube video — now that YouTube itself is sourced live.
getMediaItems() is now async: it fetches the channel's recent uploads, de-duplicates against hand-curated entries (curated wins on id collisions), and returns everything newest-first.
getFeaturedMedia() now falls back to the 3 most recent items across the merged library when nothing in MEDIA_ITEMS is manually marked featured, so the homepage teaser stays current on its own. A manual pin of exactly 3 still wins outright.
Follows getFeaturedMedia() becoming async.
Follows getMediaItems() becoming async. This is the last piece needed for the auto-pull change to build cleanly end to end.
Instagram support (types, validation, card rendering) is untouched — just not selectable as a filter until real Instagram entries are added to MEDIA_ITEMS.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
samanyugoyal2010
approved these changes
Sep 6, 2026
samanyugoyal2010
left a comment
Contributor
There was a problem hiding this comment.
Look's good @735meis nice work. Thanks for picking up the initial scaffold I had
Contributor
|
@735meis I am merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finishes out @samanyugoyal2010's media library scaffold (
codex/add-media-library) so it's production-ready:lib/youtube.ts): pulls the channel's recent uploads live via the YouTube Data API v3, cached with hourly ISR revalidation — post a new video and it shows up on/mediaand the homepage teaser on its own, no code change or redeploy.getMediaItems()/getFeaturedMedia()now merge hand-curated entries (MEDIA_ITEMS— still how Instagram gets added, since IG has no equivalent auto-pull yet) with the live YouTube fetch, newest first. The homepage's 3 featured slots auto-fill from the latest uploads unless exactly 3 items are manually pinned./mediafor now (per request) until real Instagram entries exist — everything else Instagram-related (types, validation, card rendering) is untouched, so it's a one-line change to bring back..env.exampledocuments the newYOUTUBE_API_KEY/YOUTUBE_CHANNEL_HANDLE/YOUTUBE_CHANNEL_IDvars, following the same optional/fail-soft convention as Clerk/Supabase/Resend.Verification
npm run typecheck,npm run lint,npm run buildall pass@CodeWithPurposeTeamchannel end-to-end (bothchannels.listandplaylistItems.list) — confirmed the app correctly renders the channel's live uploads on/media🤖 Generated with Claude Code