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

  1. // ==UserScript==
  2. // @name YouTube to MP3 Downloader Button
  3. // @description Adds a download button to YouTube videos which allows you to download the MP3 of the video with MediaHuman YouTube to MP3
  4. // @author FaySmash
  5. // @include http*://*.youtube.com/*
  6. // @include http*://youtube.com/*
  7. // @include http*://*.youtu.be/*
  8. // @include http*://youtu.be/*
  9. // @run-at document-end
  10. // @version 2.1
  11. // @namespace youtube.to.mp3.downloader.button
  12. // ==/UserScript==
  13.  
  14. function AddButton() {
  15.  
  16. var subscribeButton = document.querySelectorAll("ytd-subscribe-button-renderer.ytd-watch-metadata");
  17.  
  18. var downloadButton = document.createElement("button");
  19. if (typeof downloadButton !== "undefined"){
  20. downloadButton.id = "downloadButton"
  21. downloadButton.appendChild(document.createTextNode("⤓"));
  22. downloadButton.style.width = "36px";
  23. downloadButton.style.height = "36px";
  24. downloadButton.style.border = "0";
  25. downloadButton.style.borderRadius = "18px";
  26. downloadButton.style.cursor = "pointer";
  27. downloadButton.style.fontFamily = "inherit";
  28. downloadButton.style.fontWeight = "bold";
  29. downloadButton.style.marginLeft = "8px";
  30. downloadButton.style.fontSize = "x-large";
  31. downloadButton.onclick = function() {
  32. document.location.href = 'yt2mp3://' + (location.href);
  33. }
  34. }
  35.  
  36. if (typeof subscribeButton[0] !== "undefined"){
  37. subscribeButton[0].appendChild(downloadButton);
  38. }
  39. }
  40.  
  41. setInterval(function() {
  42. if (document.getElementById("info") && document.getElementById("downloadButton") === null)
  43. AddButton();
  44. }, 100);