// YouTube API key const API_KEY = 'AIzaSyD-arluaFfSq6EbDsYCcNC2OwzqNIL6iIE'; const MAX_RESULTS = 15; const CHANNEL_ID = 'UC-9-kyTW8ZkZNDHQJ6FgpwQ'; // YouTube Music channel // Create matrix rain effect function createMatrixRain() { const chars = "01アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン"; const container = document.body; for (let i = 0; i < 50; i++) { const char = document.createElement('div'); char.className = 'matrix-char'; char.textContent = chars.charAt(Math.floor(Math.random() * chars.length)); char.style.left = `${Math.random() * 100}vw`; char.style.animationDelay = `${Math.random() * 5}s`; char.style.animationDuration = `${3 + Math.random() * 7}s`; container.appendChild(char); } } // Fetch videos from YouTube API async function fetchVideos() { try { const response = await fetch( `https://www.googleapis.com/youtube/v3/search?key=${API_KEY}&channelId=${CHANNEL_ID}&part=snippet,id&order=date&maxResults=${MAX_RESULTS}` ); const data = await response.json(); displayVideos(data.items); } catch (error) { console.error('Error fetching videos:', error); document.getElementById('video-container').innerHTML = `

Failed to load videos. Please try again later.

`; feather.replace(); } } // Display videos in the grid function displayVideos(videos) { const container = document.getElementById('video-container'); container.innerHTML = ''; videos.forEach(video => { if (video.id.kind === 'youtube#video') { const videoCard = document.createElement('video-card'); videoCard.setAttribute('video-id', video.id.videoId); videoCard.setAttribute('title', video.snippet.title); videoCard.setAttribute('thumbnail', video.snippet.thumbnails.medium.url); videoCard.setAttribute('channel', video.snippet.channelTitle); container.appendChild(videoCard); } }); } // Initialize the app document.addEventListener('DOMContentLoaded', () => { createMatrixRain(); fetchVideos(); });