Download Audio & Video for YouTube v2.6 (MP3, M4V, FULL HD, MP4, FLV, WKV, ACC, etc) - The Best!?

This script helps to add a YouTube download button.

目前為 2018-06-07 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Download Audio & Video for YouTube v2.6 (MP3, M4V, FULL HD, MP4, FLV, WKV, ACC, etc) - The Best!?
// @description This script helps to add a YouTube download button.
// @namespace https://greasyfork.org/
// @homepageURL https://greasyfork.org/scripts/34613
// @supportURL https://greasyfork.org/scripts/34613/feedback
// @author Punisher
// @version 2.6
// @date 2018-06-07
// @compatible chrome
// @compatible firefox
// @compatible opera
// @compatible safari
// @license GNU GPL v3.0 or later. http://www.gnu.org/copyleft/gpl.html
// @match http*://www.youtube.com/*
// @include http*://*.youtube.com/*
// @include http*://youtube.com/*
// @include http*://*.youtu.be/*
// @include http*://youtu.be/*
// ==/UserScript==

function polymerInject() {
    var buttonDiv = document.createElement("div");
    buttonDiv.id = "downloadButton";

    var subscribeButton = document.querySelector("#subscribe-button paper-button");
    subscribeButton.style.display = "initial";
    subscribeButton.style.width = "170px";

    var addButton = document.createElement("button");
    addButton.appendChild(document.createTextNode("DOWNLOAD"));
    addButton.style.width = "170px";
    addButton.style.position = "relative";
    addButton.style.boxSizing = "border-box";
    addButton.style.minWidth = "5.14em";
    addButton.style.textAlign = "center";
    addButton.style.padding = "10px 16px";
    addButton.style.marginTop = "5px";
    addButton.style.border = "0";
    addButton.style.borderRadius = "2px";
    addButton.style.cursor = "pointer";
    addButton.style.color = "#ffffff";
    addButton.style.backgroundColor = "#3a3a3a";
    addButton.style.fontSize = "1.4rem";
    addButton.style.fontFamily = "inherit";
    addButton.style.fontStyle = "inherit";
    addButton.style.fontWeight = "500";
    addButton.style.textTransform = "uppercase";
    addButton.style.letterSpacing = "0.007px";
    addButton.onclick = function() {

        javascript:(function() {
          var vid = document.location.href;
          if (vid.indexOf('youtube.com')<0) {
            vid = window.prompt('Youtube');
          }
          if (vid && vid.indexOf('youtube.com')) {
            window.open('http://saveclipbro.com/convert?linkToDownload=' + encodeURIComponent(location.href) + '&submit=');
          } else {
            alert('');
          }
        })();
    };
    buttonDiv.appendChild(addButton);

    var targetElement = document.querySelectorAll("[id='subscribe-button']");
    for (var i = 0; i < targetElement.length; i++) {
        if (targetElement[i].className.indexOf("ytd-video-secondary-info-renderer") > -1) {
            targetElement[i].appendChild(buttonDiv);
        }
    }
}

function bugTest(fixBug, textDirection) {
    var likeButton=document.getElementById('watch-like');
    if (likeButton) {
        var spanElements=likeButton.getElementsByClassName('yt-uix-button-content');
    }  
  
    var marginPixels=10, marginPixels=1;
}

setInterval(function() {
    if (document.getElementById("count") && document.getElementById("downloadButton") === null)
        polymerInject();
}, 100);
standardInject();