Youtube2mp3

This script helps to add a YouTube download button.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name     Youtube2mp3
// @version  1.0.0
// @namespace https://greasyfork.org/
// @author Aisu
// @description This script helps to add a YouTube download button.
// @match *://www.youtube.com/*
// ==/UserScript==

function polymerInject() {
	var buttonDiv = document.createElement("div");
	buttonDiv.id = "downloadButton";
  
	var subscribeButton = document.querySelector("#subscribe-button paper-button");
	subscribeButton.style.display = "initial";
	subscribeButton.style.width = "170px";
  
  var addButton = document.createElement("button");
	addButton.appendChild(document.createTextNode("DOWNLOAD"));
	addButton.style.width = "170px";
	addButton.style.position = "relative";
	addButton.style.boxSizing = "border-box";
	addButton.style.minWidth = "5.14em";
	addButton.style.textAlign = "center";
	addButton.style.padding = "10px 16px";
	addButton.style.marginTop = "5px";
	addButton.style.border = "0";
	addButton.style.borderRadius = "2px";
	addButton.style.cursor = "pointer";
	addButton.style.color = "#ffffff";
	addButton.style.backgroundColor = "#3a3a3a";
	addButton.style.fontSize = "1.4rem";
	addButton.style.fontFamily = "inherit";
	addButton.style.fontStyle = "inherit";
	addButton.style.fontWeight = "500";
	addButton.style.textTransform = "uppercase";
	addButton.style.letterSpacing = "0.007px";
	addButton.onclick = function(){
    
    javascript:(function(){
          var vid = document.location.href;
          if (vid.indexOf('youtube.com')<0){vid = window.prompt('Youtube');}
          if (vid && vid.indexOf('youtube.com')){window.open('http://convert2mp3.net/en/index.php?p=call&format=mp3&url=' + vid);}
					else {alert('');}
        })();
    };
  
  buttonDiv.appendChild(addButton);
  
  var targetElement = document.querySelectorAll("[id='subscribe-button']");
  for (var i = 0; i < targetElement.length; i++) {
    if (targetElement[i].className.indexOf("ytd-video-secondary-info-renderer") > -1) {targetElement[i].appendChild(buttonDiv);}
	}
}

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