Raw Source
AddonDeveloper / YouTube mp3 Converter

// ==UserScript==
// @name            YouTube mp3 Converter
// @description     Youtube Converter to MP3 & MP4.
// @icon            https://www.rcyoutube.com/userscript/icon.png
//
// @author          Addon Developer
// @namespace       https://www.rcyoutube.com/
// @downloadURL     https://www.rcyoutube.com/userscript/rcyoutube.user.js
//
// @license         GPL-3.0-or-later
// @copyright       2020, Addon Developer
//
// @include         http://www.youtube.com/*
// @include         https://www.youtube.com/*
//
// @version         1.3
// @updateURL       https://www.rcyoutube.com/userscript/rcyoutube.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("rcyoutube") === 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 = "rcyoutube";
    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);
        }
    }
}


})();