import type { Metadata } from 'next'; import { Button } from '@/components/ui/button'; import Link from 'next/link'; import { ExternalLink } from 'lucide-react'; export const metadata: Metadata = { title: "Video Gallery - Community Coverage of Chelsea Smallwood", description: "Watch YouTube commentary and analysis on Chelsea Smallwood, The Other Woman and the Wife, and the ongoing controversy.", }; interface Video { id: string; title: string; } // Replaced broken video IDs with working ones. const videoIds = [ 'MdTWPuNQ1B8', // Authentic Observer 'e6rHHtq5K1k', '-6Zftd8C7NE', // Coop 'AbVsR7XzNBc', // clout 'lJ8zHiwfrqs', 'q8zevCJ6TKw', 'XzBQ-klpoRM', // New video 1 'Zoi_YFcRyaE', // New video 2 'P2QUvDHvokM' // New video 3 // 'DK14VZ4Fyl4', // Lauren ]; // Updated fallback data to be a reliable source of working videos. const fallbackData: Video[] = [ { id: 'DK14VZ4Fyl4', title: 'Life Coach CHELSEA SMALLWOOD Is SUING Her HUSBANDS Ex Wife... It Gets WORSE' }, { id: '-6Zftd8C7NE', title: "The Husband Stealing, Cheating, \"TikTok Life Coach\"" }, ]; async function getYouTubeVideos(ids: string[]): Promise { const apiKey = process.env.YOUTUBE_API_KEY; if (!apiKey) { console.warn("YOUTUBE_API_KEY environment variable not set. Using hardcoded video titles as fallback."); return fallbackData; } const url = `https://www.googleapis.com/youtube/v3/videos?part=snippet&id=${ids.join(',')}&key=${apiKey}`; try { const response = await fetch(url, { next: { revalidate: 3600 } }); // Revalidate every hour if (!response.ok) { const errorData = await response.json(); console.error("YouTube API Error:", errorData.error.message); console.log("Falling back to hardcoded video data."); return fallbackData; } const data = await response.json(); if (!data.items || data.items.length === 0) { console.warn("YouTube API returned no items for the given video IDs. Falling back to hardcoded data."); return fallbackData; } interface YouTubeVideoItem { id: string; snippet: { title: string; }; } const fetchedVideos = data.items.map((item: YouTubeVideoItem) => ({ id: item.id, title: item.snippet.title, })); if (fetchedVideos.length < ids.length) { console.warn(`YouTube API only returned ${fetchedVideos.length} videos out of ${ids.length} requested. Some videos may be private or deleted.`); } return fetchedVideos; } catch (error) { console.error("Failed to fetch from YouTube API:", error); console.log("Falling back to hardcoded video data."); return fallbackData; } } export default async function GalleryPage() { const videos = await getYouTubeVideos(videoIds); return (

YouTube Community Coverage

Commentary and analysis from creators across the platform.

{videos.length > 0 ? videos.map((video) => (
{/* 16:9 Aspect Ratio */}

{video.title}

Watch on YouTube
)) : (

Could not load videos. Please try again later.

)}
); }