Template Blogger YOUTUBE DOWNLOAD

 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'>&#9654; YT DOWNLOADER PRO MAX</div>

  <div class='sub'>Download Video &amp; 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()'>&#11015; 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>&#169; 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 = &quot;https://LINK-REFLIT-ANDA.sisko.replit.dev&quot;;

const ADS = &quot;https://YOUR-ADS-LINK.com&quot;; // optional


/* =========================

   PREVIEW VIDEO

========================= */

function loadVideo(){

  const url = document.getElementById(&quot;urlInput&quot;).value;

  if(!url) return alert(&quot;Masukkan link&quot;);


  window.open(ADS, &quot;_blank&quot;); // ADS OPEN


  document.getElementById(&quot;box&quot;).style.display = &quot;none&quot;;

  document.getElementById(&quot;loading&quot;).style.display = &quot;block&quot;;


  fetch(API + &quot;/api/info?url=&quot; + encodeURIComponent(url))

  .then(res =&gt; res.json())

  .then(data =&gt; {


    document.getElementById(&quot;loading&quot;).style.display = &quot;none&quot;;

    document.getElementById(&quot;box&quot;).style.display = &quot;block&quot;;


    document.getElementById(&quot;title&quot;).innerHTML = data.title || &quot;Tidak ditemukan&quot;;


    if(data.thumbnail){

      document.getElementById(&quot;thumb&quot;).src = data.thumbnail;

      document.getElementById(&quot;thumb&quot;).style.display = &quot;block&quot;;

    }


  })

  .catch(() =&gt; {

    document.getElementById(&quot;loading&quot;).style.display = &quot;none&quot;;

    alert(&quot;Gagal ambil data&quot;);

  });

}


/* =========================

   DOWNLOAD VIDEO

========================= */

function downloadVideo(){

  const url = document.getElementById(&quot;urlInput&quot;).value;

  if(!url) return alert(&quot;Masukkan link&quot;);


  window.open(ADS, &quot;_blank&quot;); // ADS OPEN


  setTimeout(() =&gt; {

    window.location.href =

      API + &quot;/api/download?url=&quot; + 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);

});




package.js

{
  "name": "api",
  "version": "1.0.0",
  "main": "index.js",
  "type": "commonjs",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "cors": "^2.8.6",
    "express": "^4.22.1",
    "ytdl-core": "^4.11.5"
  }
}


REFLIT


entrypoint = "index.js"
modules = ["nodejs-22", "python-3.11"]

[nix]
channel = "stable-24_11"

[deployment]
run = ["node", "index.js"]
deploymentTarget = "autoscale"
ignorePorts = false

[[ports]]
localPort = 3000
externalPort = 80
run = "node index.js"



KALAU BELUM FAHAM CARANYA TONTON VIDEONYA 

Tidak ada komentar:

Posting Komentar