diff --git a/src/app/dadvocate/page.tsx b/src/app/dadvocate/page.tsx new file mode 100644 index 0000000..2c088cb --- /dev/null +++ b/src/app/dadvocate/page.tsx @@ -0,0 +1,146 @@ + +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: "Dadvocate Vids - Exposing False Narratives", + description: "A collection of videos from the Dadvocate community, providing counter-narratives and analysis.", + robots: { + index: false, + follow: false, + } +}; + +interface Video { + id: string; + title: string; +} + +// Placeholder video IDs - these can be replaced with actual Dadvocate video IDs. +const videoIds = [ + 'lJ8zHiwfrqs', + 'q8zevCJ6TKw', + 'DK14VZ4Fyl4' +]; + +// Updated fallback data to be a reliable source of working videos. +const fallbackData: Video[] = [ + { id: 'lJ8zHiwfrqs', title: 'Placeholder Dadvocate Video 1' }, + { id: 'q8zevCJ6TKw', title: 'Placeholder Dadvocate Video 2' }, + { id: 'DK14VZ4Fyl4', title: 'Placeholder Dadvocate Video 3' }, +]; + +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; + } + + const fetchedVideos = data.items.map((item: any) => ({ + 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 DadvocatePage() { + const videos = await getYouTubeVideos(videoIds); + + return ( +
+
+
+
+

+ Dadvocate Vids +

+

+ A curated collection of videos providing important context and counter-narratives. +

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

+ {video.title} +

+ + Watch on YouTube + +
+
+ )) : ( +

Could not load videos. Please try again later.

+ )} +
+
+
+ + +
+ ); +} diff --git a/src/app/gallery/page.tsx b/src/app/gallery/page.tsx index 43b0a7f..85aa8f0 100644 --- a/src/app/gallery/page.tsx +++ b/src/app/gallery/page.tsx @@ -21,7 +21,8 @@ const videoIds = [ '-6Zftd8C7NE', // Coop 'AbVsR7XzNBc', // clout 'lJ8zHiwfrqs', - 'DK14VZ4Fyl4', // Lauren + 'q8zevCJ6TKw' + // 'DK14VZ4Fyl4', // Lauren ]; // Updated fallback data to be a reliable source of working videos.