Greasy Fork

Greasy Fork is available in English.

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

当前为 2021-04-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴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      1.4
// @namespace    youtube.to.mp3.downloader.button
// ==/UserScript==

function AddButton() {

    var subscribeButton = document.querySelectorAll("tp-yt-paper-button.ytd-subscribe-button-renderer");
    subscribeButton[0].style.display = "initial";
    subscribeButton[0].style.width = "200px";
    subscribeButton[0].style.textAlign = "center";
    
    var downloadButton = document.createElement("button");
    downloadButton.id = "downloadButton"
    downloadButton.appendChild(document.createTextNode("Download MP3"));
    downloadButton.style.width = "200px";
    downloadButton.style.position = "relative";
    downloadButton.style.boxSizing = "border-box";
    downloadButton.style.minWidth = "5.14em";
    downloadButton.style.textAlign = "center";
    downloadButton.style.padding = "10px 16px";
    downloadButton.style.margin = "auto 4px";
    downloadButton.style.border = "0";
    downloadButton.style.borderRadius = "2px";
    downloadButton.style.cursor = "pointer";
    downloadButton.style.color = "hsla(0, 0%, 6.7%, .6)";
    downloadButton.style.fontSize = "1.4rem";
    downloadButton.style.fontFamily = "inherit";
    downloadButton.style.fontStyle = "inherit";
    downloadButton.style.fontWeight = "500";
    downloadButton.style.textTransform = "uppercase";
    downloadButton.style.letterSpacing = "0.007px";
    downloadButton.onclick = function() {
        document.location.href = 'yt2mp3://' + (location.href);
    };

    var targetElement = document.querySelectorAll("[id='subscribe-button']");
    targetElement[1].appendChild(downloadButton); 
}

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