🎬 מחולל אתרי פלייליסט YouTube

שליפת קישורים ויצירת קוד HTML מלא לאתר נגן

🔗 קישור לפלייליסט

הדבק קישור לפלייליסט YouTube. המערכת תשלוף את מזהי הסרטונים ותייצר קוד HTML לאתר נגן עם רשימת סרטונים ותמונות ממוזערות.

`; } async function createPlaylistSite() { const input = document.getElementById("playlistUrl").value.trim(); const button = document.getElementById("createButton"); const playlistId = getPlaylistId(input); if (!playlistId) { showStatus( "נא להזין קישור תקין לפלייליסט YouTube הכולל מזהה list.", "error" ); return; } button.disabled = true; button.textContent = "⏳ שולף ומייצר קוד..."; document.getElementById("resultsPanel").classList.add("hidden"); try { const ids = await fetchVideoIds(playlistId); generatedHTML = generatePlayerSite(ids, playlistId); document.getElementById("generatedCode").value = generatedHTML; document.getElementById("resultSummary").textContent = "נמצאו " + ids.length + " סרטונים. נוצר קוד HTML מלא הכולל נגן ורשימת סרטונים."; document.getElementById("resultsPanel").classList.remove("hidden"); showStatus( "הקוד נוצר בהצלחה! אפשר להעתיק אותו או להוריד קובץ HTML.", "success" ); } catch (error) { console.error(error); showStatus( "לא הצלחנו לשלוף את הפלייליסט. ייתכן שהשירותים אינם זמינים, " + "שהגישה נחסמת על ידי הדפדפן או שהפלייליסט פרטי.", "error" ); } finally { button.disabled = false; button.textContent = "🎬 שלוף פלייליסט וצור קוד"; } } async function copyGeneratedCode() { if (!generatedHTML) { showStatus("אין קוד להעתקה.", "error"); return; } try { await navigator.clipboard.writeText(generatedHTML); showStatus("קוד ה-HTML הועתק בהצלחה!", "success"); } catch { const textarea = document.getElementById("generatedCode"); textarea.focus(); textarea.select(); const success = document.execCommand("copy"); showStatus( success ? "הקוד הועתק בהצלחה!" : "ההעתקה נכשלה. אפשר להעתיק ידנית.", success ? "success" : "error" ); } } function downloadGeneratedCode() { if (!generatedHTML) { showStatus("אין קוד להורדה.", "error"); return; } const blob = new Blob( ["\n" + generatedHTML.replace(/^\s*/i, "")], {type:"text/html;charset=utf-8"} ); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = "youtube-playlist-player.html"; document.body.appendChild(link); link.click(); link.remove(); setTimeout(() => URL.revokeObjectURL(url), 1000); showStatus("קובץ HTML הורד בהצלחה!", "success"); } function clearAll() { document.getElementById("playlistUrl").value = ""; document.getElementById("generatedCode").value = ""; document.getElementById("resultsPanel").classList.add("hidden"); document.getElementById("status").className = "status"; document.getElementById("status").textContent = ""; generatedHTML = ""; } document.getElementById("playlistUrl").addEventListener("keydown", event => { if (event.key === "Enter") createPlaylistSite(); });