Youtube Downloader

můžeš stahovat youtube videa

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Youtube Downloader
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  můžeš stahovat youtube videa
// @author       You
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==


getSpan = function (text, className) {
    var _tn = document.createTextNode(text);
    var span = document.createElement("span");
    span.className = className;
    span.appendChild(_tn);
    return span;
};

videoURL = function () {
    let url = window.location.href;
    url = url.split("=");
    return url[1];
};

function createButton() {
    var obj = document.querySelector('#top-row>#subscribe-button');
    if (obj !== null) {
        var btnRow = document.getElementById('bestvd2');
        if (btnRow === null) {
            var bestvd2 = document.createElement("div");
            bestvd2.id = "bestvd2";
            bestvd2.className = "style-scope";

            var bvd2_btn = document.createElement("div");
            bvd2_btn.className = "style-scope bvd2_btn";

            bvd2_btn.style = "background-color: green; border: solid 2px green; border-radius: 2px; color: white; padding: 0px 15px; font-size: 14px; cursor:pointer; height:33px;margin-right: 7px;margin-top: 7px;line-height: 33px;font-weight: 500; display:inline-block;";

            bvd2_btn.appendChild(getSpan("Download", ""));
            bvd2_btn.onclick = function () {
                window.open("https://y2mate.com/youtube/" + videoURL(), '_blank');
            };
            obj.parentNode.insertBefore(bestvd2, obj);
            bestvd2.appendChild(bvd2_btn);
        }
    }
}

document.body.onload = function () {
    createButton();
    console.log("Loaded");
};