TEMPLATE
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<b:include data='blog' name='all-head-content'/>
<title>YT Downloader Pro Max</title>
<b:skin><![CDATA[
body{
margin:0;
font-family:Arial;
background:linear-gradient(135deg,#0f0f0f,#1a1a1a);
color:#fff;
}
/* HEADER */
header{
background:linear-gradient(90deg,#0f0f0f,#111);
padding:18px;
text-align:center;
border-bottom:2px solid #ff3b3b;
box-shadow:0 5px 20px rgba(0,0,0,0.5);
}
.logo{
font-size:22px;
font-weight:bold;
color:#ff3b3b;
}
.sub{
font-size:12px;
color:#aaa;
margin-top:5px;
}
.wrap{
padding:20px;
text-align:center;
}
input{
width:85%;
padding:14px;
border-radius:10px;
border:none;
outline:none;
font-size:15px;
}
button{
padding:12px 16px;
margin-top:10px;
border:none;
border-radius:10px;
background:#ff3b3b;
color:#fff;
cursor:pointer;
font-weight:bold;
}
.box{
margin-top:20px;
background:#1a1a1a;
padding:15px;
border-radius:10px;
display:none;
}
#thumb{
width:100%;
max-width:350px;
border-radius:10px;
margin-bottom:10px;
}
/* FOOTER */
footer{
margin-top:40px;
background:#0d0d0d;
padding:20px;
text-align:center;
border-top:1px solid #222;
color:#aaa;
font-size:13px;
}
footer a{
color:#ff3b3b;
text-decoration:none;
font-weight:bold;
}
.loading{
display:none;
margin-top:10px;
color:#ff3b3b;
}
.spinner{
width:18px;
height:18px;
border:3px solid #333;
border-top:3px solid #ff3b3b;
border-radius:50%;
display:inline-block;
animation:spin 1s linear infinite;
}
@keyframes spin{
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
]]></b:skin>
</head>
<body>
<!-- HEADER -->
<header>
<div class='logo'>▶ YT DOWNLOADER PRO MAX</div>
<div class='sub'>Download Video & MP3 YouTube Gratis</div>
</header>
<!-- CONTENT -->
<div class='wrap'>
<h3>Tempel Link YouTube</h3>
<input id='urlInput' placeholder='https://youtube.com/watch?v=...'/>
<br/>
<button onclick='loadVideo()'>Preview Video</button>
<div class='loading' id='loading'>
<span class='spinner'/> Loading...
</div>
<div class='box' id='box'>
<img id='thumb' style='display:none;'/>
<h3 id='title'>...</h3>
<button onclick='downloadVideo()'>⬇ DOWNLOAD MP4</button>
</div>
</div>
<!-- BLOGGER REQUIRED SECTION -->
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='HTML1' locked='false' title='Downloader' type='HTML' version='1'>
<b:widget-settings>
<b:widget-setting name='content'/>
</b:widget-settings>
<b:includable id='main'>
<div class='widget-content'>
<data:content/>
</div>
</b:includable>
</b:widget>
</b:section>
<!-- FOOTER + CREDIT DZAKYNET -->
<footer>
<div>© 2026 YT Downloader Pro Max</div>
<div style='margin-top:8px;'>
Template by
<a href='https://www.dzakynet.my.id/' target='_blank'>
Dzakynet
</a>
</div>
</footer>
<script>
/* =========================
API SETTING
========================= */
const API = "https://LINK-REFLIT-ANDA.sisko.replit.dev";
const ADS = "https://YOUR-ADS-LINK.com"; // optional
/* =========================
PREVIEW VIDEO
========================= */
function loadVideo(){
const url = document.getElementById("urlInput").value;
if(!url) return alert("Masukkan link");
window.open(ADS, "_blank"); // ADS OPEN
document.getElementById("box").style.display = "none";
document.getElementById("loading").style.display = "block";
fetch(API + "/api/info?url=" + encodeURIComponent(url))
.then(res => res.json())
.then(data => {
document.getElementById("loading").style.display = "none";
document.getElementById("box").style.display = "block";
document.getElementById("title").innerHTML = data.title || "Tidak ditemukan";
if(data.thumbnail){
document.getElementById("thumb").src = data.thumbnail;
document.getElementById("thumb").style.display = "block";
}
})
.catch(() => {
document.getElementById("loading").style.display = "none";
alert("Gagal ambil data");
});
}
/* =========================
DOWNLOAD VIDEO
========================= */
function downloadVideo(){
const url = document.getElementById("urlInput").value;
if(!url) return alert("Masukkan link");
window.open(ADS, "_blank"); // ADS OPEN
setTimeout(() => {
window.location.href =
API + "/api/download?url=" + encodeURIComponent(url);
}, 1500);
}
</script>
</body>
</html>
INDEX.JS
const express = require("express");
const cors = require("cors");
const { exec } = require("child_process");
const path = require("path");
const fs = require("fs");
const app = express();
app.use(cors());
app.get("/", (req, res) => {
res.send("YT SERVER AKTIF 🚀");
});
/* =========================
INFO VIDEO
========================= */
app.get("/api/info", async (req, res) => {
try {
const url = req.query.url;
if (!url) return res.status(400).json({ error: "URL kosong" });
const data = await fetch(
`https://www.youtube.com/oembed?url=${encodeURIComponent(url)}&format=json`,
);
const json = await data.json();
res.json({
title: json.title,
author: json.author_name,
thumbnail: json.thumbnail_url,
});
} catch (e) {
res.status(500).json({ error: "Gagal ambil info" });
}
});
/* =========================
DOWNLOAD FILE (FIX UTAMA)
========================= */
app.get("/api/download", (req, res) => {
const url = req.query.url;
if (!url) return res.send("URL kosong");
const fileName = `video_${Date.now()}.mp4`;
const filePath = path.join(__dirname, fileName);
const cmd = `yt-dlp -f mp4 -o "${filePath}" "${url}"`;
exec(cmd, (err) => {
if (err) {
console.log(err);
return res.send("Gagal download video");
}
// kirim file ke user
res.download(filePath, () => {
fs.unlink(filePath, () => {}); // hapus file setelah kirim
});
});
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, "0.0.0.0", () => {
console.log("RUNNING PORT " + PORT);
});
Tidak ada komentar:
Posting Komentar