Skip to main content

VIDEO EMBED CONVERTER FOR BLOGGER by ChatGPT [SOURCE CODE]

 <h1 style="text-align: left;"><b><a href="https://chatgpt.com/share/69315a6f-151c-800c-b196-b385117987e9" target="_blank">My ChatGPT-Session in WORK-IT-OUT!</a></b></h1>

<br />

<h1 style="text-align: center;"><b><i><a href="https://drive.google.com/file/d/1HfWyeOdq0prHvvyfUsXWpyggpWXC9VG6/view?usp=sharing" target="_blank">APK DOWNLOAD LINK by MEDIAN.CO</a></i></b></h1>

<br />

<!--==============================================-->

<!--VIDEO EMBED CONVERTER PRO v2.4.1 (Blogger Safe)-->

<!--==============================================-->


<div id="vec-wrapper" style="border: 1px solid rgb(221, 221, 221); font-family: Arial, sans-serif; font-size: 14px; margin: 16px 0px; padding: 16px;">

    <h3 style="margin-top: 0px; text-align: center;">🎬 Video Embed Converter PRO (YouTube / Shorts / TikTok / Instagram)</h3>


    <!--INPUT AREA-->

    <label style="display: block; font-weight: bold; margin-bottom: 4px;">

        1) Paste your video links here (one URL per line):

    </label>


    <textarea id="vec-input" style="font-family: Consolas, monospace; font-size: 13px; margin-bottom: 8px; min-height: 100px; padding: 8px; width: 100%;"></textarea>


    <!--OUTPUT OPTIONS-->

    <div style="align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0px;">

        <span style="font-weight: bold;">2) Generated embed code:</span>


        <span>Output style:</span>

        <select id="vec-mode" style="font-size: 12px; padding: 4px 8px;">

            <option value="card">Bootstrap Card</option>

            <option value="shade">Shaded Box</option>

            <option value="raw">Raw HTML Only</option>

        </select>


        <button id="vec-copy-btn" style="background: rgb(240, 240, 240); border-radius: 4px; border: 1px solid rgb(68, 68, 68); cursor: pointer; font-size: 12px; padding: 6px 12px;">

            Copy code

        </button>

    </div>


    <!--OUTPUT CODE BLOCK (VS Code style, mobile safe)-->

    <pre id="vec-output" style="background: rgb(30, 30, 30); border-radius: 6px; color: #d4d4d4; font-family: Consolas, monospace; font-size: 13px; line-height: 1.45; min-height: 200px; overflow-x: auto; padding: 12px; white-space: pre; width: 100%;"></pre>


    <!--PREVIEW AREA-->

    <div style="border-top: 1px solid rgb(221, 221, 221); margin-top: 18px; padding-top: 10px;">

        <div style="font-weight: bold; margin-bottom: 6px;">3) Live Preview:</div>

        <div id="vec-preview" style="background: rgb(250, 250, 250); padding: 10px;">

            <em>Paste URLs above to see preview…</em>

        </div>

    </div>

</div>




<!--JAVASCRIPT — FULL ENGINE-->

<script type="text/javascript">

//<![CDATA[

(function () {


    var inputEl   = document.getElementById("vec-input");

    var outputEl  = document.getElementById("vec-output");

    var previewEl = document.getElementById("vec-preview");

    var copyBtn   = document.getElementById("vec-copy-btn");

    var modeEl    = document.getElementById("vec-mode");


    var INDENT = "    "; // 4 spaces in formatter

    var ADD_BLANK_LINES = true;


    var ytTitleCache = {};


    function esc(s) {

        return s.replace(/&/g,"&amp;")

                .replace(/</g,"&lt;")

                .replace(/>/g,"&gt;");

    }


    function norm(url) {

        url = url.trim();

        if (!url) return "";

        if (!/^https?:\/\//i.test(url)) url = "https://" + url;

        return url;

    }


    function getPlatform(url) {

        if (url.includes("youtu")) return "YouTube";

        if (url.includes("tiktok")) return "TikTok";

        if (url.includes("instagram")) return "Instagram";

        return "Video";

    }


    // -------- FALLBACK TITLE (URL-based) --------

    function fallbackTitle(url) {

        try {

            var u = new URL(url);

            var p = u.pathname.split("/").filter(Boolean);

            return p[p.length - 1] || url;

        } catch (e) {

            return url;

        }

    }


    // -------- SPLIT YOUTUBE TITLE INTO 3 ROWS --------

    function splitYtTitle(full) {

        var m = full.match(/\([^()]*\)\s*$/);

        if (!m) {

            return {

                platform: "Source: YouTube",

                main: full,

                extra: ""

            };

        }


        var extra = m[0].trim();

        var main = full.replace(/\([^()]*\)\s*$/, "").trim();


        return {

            platform: "Source: YouTube",

            main: main,

            extra: extra

        };

    }


    // -------- FETCH REAL YouTube TITLE --------

    function fetchYTTitle(url) {

        if (ytTitleCache[url]) return Promise.resolve(ytTitleCache[url]);


        var oembed = "https://www.youtube.com/oembed?format=json&url=" + encodeURIComponent(url);


        return fetch(oembed)

            .then(r => r.ok ? r.json() : null)

            .then(d => {

                if (d && d.title) {

                    ytTitleCache[url] = d.title;

                    return d.title;

                }

                return null;

            })

            .catch(() => null);

    }


    function getTitle(url, platform) {

        if (platform === "YouTube") {

            return fetchYTTitle(url).then(real => {

                if (real) return splitYtTitle(real);

                return {

                    platform: "Source: YouTube",

                    main: fallbackTitle(url),

                    extra: ""

                };

            });

        }


        return Promise.resolve({

            platform: "Source: " + platform,

            main: fallbackTitle(url),

            extra: ""

        });

    }


    // -------- EMBEDS --------

    function ytId(url) {

        var m;

        if ((m = url.match(/youtu\.be\/([^?&]+)/))) return m[1];

        if ((m = url.match(/shorts\/([^?&]+)/))) return m[1];

        if ((m = url.match(/[?&]v=([^?&]+)/))) return m[1];

        return "";

    }


    function ytIsShort(url) {

        return url.includes("/shorts/");

    }


    function ytEmbed(url) {

        var id = ytId(url);

        if (!id) return "<!-- Invalid YouTube link -->";

        var ratio = ytIsShort(url) ? "177%" : "56.25%";


        return ''

            + '<div style="max-width:100%; margin:0 auto;">'

            + '    <div style="position:relative; width:100%; padding-bottom:'+ratio+'; height:0; overflow:hidden;">'

            + '        <iframe src="https://www.youtube.com/embed/'+id+'"'

            + '            allowfullscreen'

            + '            style="position:absolute; top:0; left:0; width:100%; height:100%; border:0;">'

            + '        </iframe>'

            + '    </div>'

            + '</div>';

    }


    function tkEmbed(url) {

        return ''

            + '<blockquote class="tiktok-embed" cite="'+url+'"'

            + '    style="max-width:100%; min-width:100%; margin:0 auto;">'

            + '    <section></section>'

            + '</blockquote>';

    }


    function igEmbed(url) {

        return ''

            + '<blockquote class="instagram-media"'

            + '    data-instgrm-permalink="'+url+'"'

            + '    data-instgrm-version="14"'

            + '    style="background:#fff; border:0; margin:0 auto; max-width:540px; width:100%;">'

            + '    <a href="'+url+'">&nbsp;</a>'

            + '</blockquote>';

    }


    // -------- WRAPPERS --------

    function wrap(inner, titleObj, mode) {


        var titleHTML =

            '<div style="font-weight:bold; font-size:14px;">' + esc(titleObj.platform) + '</div>' +

            '<div style="font-size:14px;">' + esc(titleObj.main) + '</div>' +

            (titleObj.extra ? '<div style="font-size:13px; color:#555;">'+ esc(titleObj.extra) +'</div>' : '');


        if (mode === "raw") return inner;


        if (mode === "shade") {

            return ''

                + '<div style="max-width:900px; margin:0 auto 16px; background:#f7f7f7; border:1px solid #ddd; border-radius:6px; padding:12px;">'

                +     titleHTML

                +     '<div style="margin-top:8px;">'+ inner +'</div>'

                + '</div>';

        }


        // Bootstrap card style

        return ''

            + '<div style="max-width:900px; margin:0 auto 16px; border:1px solid #dee2e6; border-radius:8px; background:#fff; box-shadow:0 2px 4px rgba(0,0,0,0.05);">'

            + '    <div style="padding:8px 12px; border-bottom:1px solid #dee2e6; background:#f8f9fa;">'

            +            titleHTML

            + '    </div>'

            + '    <div style="padding:12px;">'

            +            inner

            + '    </div>'

            + '</div>';

    }


    // -------- ASYNC CONVERSION --------

    function convertAsync(url, mode) {

        var p = getPlatform(url);


        var embed =

            p === "YouTube" ? ytEmbed(url) :

            p === "TikTok"  ? tkEmbed(url) :

            p === "Instagram" ? igEmbed(url) :

            "<!-- Unsupported URL -->";


        return getTitle(url, p).then(titleObj => ({

            html: wrap(embed, titleObj, mode),

            hasIG: p === "Instagram",

            hasTK: p === "TikTok"

        }));

    }


    // -------- HTML FORMATTER --------

    function formatHTML(html) {

        html = html.replace(/\r?\n/g,"").replace(/>\s*</g,"><");


        var parts = html.split(/(?=<)/g);

        var lvl = 0;

        var out = "";


        parts.forEach(line => {

            line = line.trim();

            if (!line) return;


            if (line.startsWith("</")) lvl--;


            out += INDENT.repeat(Math.max(lvl,0)) + line + "\n";


            if (line.match(/^<[^\/!][^>]*[^\/]>$/)) lvl++;

        });


        return out.trim();

    }


    // -------- MAIN PROCESS --------

    function processAll() {

        var urls = inputEl.value.split(/\n/).map(s=>s.trim()).filter(Boolean);

        var mode = modeEl.value;


        if (!urls.length) {

            outputEl.textContent = "";

            previewEl.innerHTML = "<em>No valid URL.</em>";

            return;

        }


        Promise.all(urls.map(u => convertAsync(u, mode))).then(res => {


            var htmlList = res.map(r => r.html).join(ADD_BLANK_LINES ? "\n\n" : "\n");


            var final = htmlList;


            if (res.some(r=>r.hasIG))

                final += '\n\n&lt;script async src="//www.instagram.com/embed.js"&gt;&lt;/script&gt;';


            if (res.some(r=>r.hasTK))

                final += '\n\n&lt;script async src="https://www.tiktok.com/embed.js"&gt;&lt;/script&gt;';


            outputEl.textContent = formatHTML(final);


            previewEl.innerHTML = htmlList;


            if (window.instgrm && window.instgrm.Embeds)

                window.instgrm.Embeds.process();

        });

    }


    // -------- EVENTS --------

    inputEl.addEventListener("input", processAll);

    modeEl.addEventListener("change", processAll);


    copyBtn.addEventListener("click", function () {

        var txt = outputEl.textContent;

        if (!txt.trim()) return;


        navigator.clipboard.writeText(txt).then(() => {

            copyBtn.textContent = "Copied!";

            setTimeout(()=>copyBtn.textContent="Copy code",1200);

        });

    });


    processAll();


})();

//]]>

</script>


<!--Instagram & TikTok embed scripts-->

<script async="" src="//www.instagram.com/embed.js"></script>

<script async="" src="https://www.tiktok.com/embed.js"></script>


Comments

Popular posts from this blog

PART 0.1.0 RAD PROTOTYPE Web-App: Post-Video & Comments [program]

Video List — JP Kanji Ultra Translation CONTROL SECTION — Login (Admin) Username: Password: Login CONTROL SECTION — Admin Panel Enable Comments Disable Comments Logout Activity Log Show Video COMMENTS DISABLED BY ADMIN Leave a Comment: Additional Comment Show Video COMMENTS DISABLED BY ADMIN Leave a Comment: Additional Comment Show Video COMMENTS DISABLED BY ADMIN Leave a Comment: Additional Comment Show Video COMMENTS DISABLED BY ADMIN Leave a Comment: Additional Comment

My Pending and Delayed POSTs SUMMARY [APPs]
MADE by ChatGPT

🔗 My Pending and Delayed POSTs SUMMARY Sort by Date Sort by Auto Title Sort by My Title Ascending Descending (Newest First) Insert URL: Your Own Title (Optional): Status: Pending Done ➕ ADD ENTRY 💾 SAVE EDIT (MAIN FORM) DATE / TIME AUTO TITLE MY TITLE STATUS URL ACTIONS 📝 TO DO LIST SUMMARY Sort by Date Sort by Header Sort by Detail ...

REPOST: Studying WATER PUMP by ROMAN ENGINEERING

*^ Ini yg Asli Gan! Mekanisme pada Concrete Pump: Kok ky Sistem Mekanik Romawi ya?! Tapi malah bisa HANYA pake PER aka bukan "MATA BOR look a like" Mekanisme Drill yg Cost Pembuatan bikin REPOT aka harus Tool SUPER Khusus Dari Material Besi yg digunakan terlihat langsung secara kasat mata Jauh Lebih Banyak drpd Per Biasa seperti yg ditunjukkan pd Video Alternatif dgn Penggunaan PER Video dr Instagram: Source: YouTube Rome's drainage machines #history #romanempire #engineering