Raw Source
AddonDeveloper / YouTube mp3 320 kbps

// ==UserScript==
// @name            YouTube mp3 320 kbps
// @description     The 320 kbps YouTube mp3 addon generates a MP3 button on YouTube.com. Convert YouTube to mp3 and download the file to your device.
// @icon            https://www.rcyoutube.com/userscript/icon.png
//
// @author          Addon Developer
// @namespace       https://www.rcyoutube.com/
// @downloadURL     https://www.rcyoutube.com/userscript/320youtube.user.js
//
// @license         MIT
// @copyright       2019, Addon Developer
//
// @include         http://www.youtube.com/*
// @include         https://www.youtube.com/*
//
// @version         1.2
// @updateURL       https://www.rcyoutube.com/userscript/320youtube.user.js
//
// @run-at          document-end
// @unwrap
// ==/UserScript==

(function() {
    'use strict';

    if (document.getElementById("firefox-app") || document.getElementById("masthead") || window.Polymer) {
    setInterval(function() {
        if (window.location.href.indexOf("watch?v=") < 0) {
            return false;
        }
        if (document.getElementById("count") && document.getElementById("320youtube") === null) {
            Addytpolymer();
        }
    }, 100);
} else {
    setInterval(function() {
        if (window.location.href.indexOf("watch?v=") < 0) {
            return false;
       }
    }, 100);
}

function Addytpolymer() {
    var buttonDiv = document.createElement("span");
    buttonDiv.style.width = "100%";
    buttonDiv.id = "320youtube";
    var addButton = document.createElement("a");
    addButton.appendChild(document.createTextNode("MP3"));
    addButton.style.width = "100%";
    addButton.style.backgroundColor = "#CC0000";
    addButton.style.color = "white";
    addButton.style.textAlign = "center";
    addButton.style.padding = "2px 10px";
    addButton.style.margin = "0px 10px";
    addButton.style.fontSize = "13px";
    addButton.style.border = "0";
    addButton.style.cursor = "pointer";
    addButton.style.borderRadius = "2px";
    addButton.style.fontFamily = "Roboto, Arial, sans-serif";
    addButton.style.textDecoration = "none";
    addButton.href = "https://www.rcyoutube.com/convert?v=" + window.location.href;
    addButton.target = "_blank";
    buttonDiv.appendChild(addButton);
    var targetElement = document.querySelectorAll("[id='count']");
    for (var i = 0; i < targetElement.length; i++) {
        if (targetElement[i].className.indexOf("ytd-video-primary-info-renderer") > -1) {
            targetElement[i].appendChild(buttonDiv);
        }
    }
}


})();