YouTube to MP3 Downloader Button

Adds a download button to YouTube videos which allows you to download the MP3 of the video with MediaHuman YouTube to MP3

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         YouTube to MP3 Downloader Button
// @description  Adds a download button to YouTube videos which allows you to download the MP3 of the video with MediaHuman YouTube to MP3
// @author       FaySmash
// @include      http*://*.youtube.com/*
// @include      http*://youtube.com/*
// @include      http*://*.youtu.be/*
// @include      http*://youtu.be/*
// @run-at       document-end
// @version      2.1
// @namespace    youtube.to.mp3.downloader.button
// ==/UserScript==

function AddButton() {

    var subscribeButton = document.querySelectorAll("ytd-subscribe-button-renderer.ytd-watch-metadata");

    var downloadButton = document.createElement("button");
    if (typeof downloadButton !== "undefined"){
        downloadButton.id = "downloadButton"
        downloadButton.appendChild(document.createTextNode("⤓"));
        downloadButton.style.width = "36px";
        downloadButton.style.height = "36px";
        downloadButton.style.border = "0";
        downloadButton.style.borderRadius = "18px";
        downloadButton.style.cursor = "pointer";
        downloadButton.style.fontFamily = "inherit";
        downloadButton.style.fontWeight = "bold";
        downloadButton.style.marginLeft = "8px";
        downloadButton.style.fontSize = "x-large";
        downloadButton.onclick = function() {
            document.location.href = 'yt2mp3://' + (location.href);
        }
    }

    if (typeof subscribeButton[0] !== "undefined"){
        subscribeButton[0].appendChild(downloadButton);
    }
}

setInterval(function() {
    if (document.getElementById("info") && document.getElementById("downloadButton") === null)
        AddButton();
}, 100);