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

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);