const API_URL = "https://eporner-proxy.vinaymadaan9.workers.dev/?query=hd&per_page=28&thumbsize=big&order=top-weekly&format=json"; async function initGallery() { const grid = document.getElementById('video-grid'); try { const res = await fetch(API_URL); const data = await res.json(); grid.innerHTML = ''; if (!data.videos || data.videos.length === 0) { grid.innerHTML = '

No streams found.

'; return; } data.videos.forEach(video => { const a = document.createElement('a'); a.className = 'card'; a.href = `watch.html?id=${video.id}&title=${encodeURIComponent(video.title)}&embed=${encodeURIComponent(video.embed)}`; a.innerHTML = `
${video.title}${video.length_min}
${video.title}
👁️ ${(video.views).toLocaleString()}⭐ ${video.rate}
`; grid.appendChild(a); }); } catch (err) { grid.innerHTML = '

Failed to load video feed.

'; } } initGallery();