Simple Youtube Downloader

Download any video and music (audio) from Youtube

当前为 2019-09-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Simple Youtube Downloader
  3. // @version 1.0
  4. // @date 2019-09-11
  5. // @description Download any video and music (audio) from Youtube
  6. // @author han2ee
  7. // @match *://*.youtube.com/*
  8. // @namespace https://gf.qytechs.cn/users/147254
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. if (document.getElementById("polymer-app") || document.getElementById("masthead") || window.Polymer) {
  15. setInterval(function() {
  16. if (window.location.href.indexOf("watch?v=") < 0) {
  17. return false;
  18. }
  19. if (document.getElementById("count") && document.getElementById("videoid") === null) {
  20. Addytpolymer();
  21. }
  22. }, 100);
  23. } else {
  24. setInterval(function() {
  25. if (window.location.href.indexOf("watch?v=") < 0) {
  26. return false;
  27. }
  28. if (document.getElementById("watch7-subscription-container") && document.getElementById("videoid") === null) {
  29. AddhtmlDV();
  30. }
  31. }, 100);
  32. }
  33.  
  34. function AddhtmlDV() {
  35. if (document.getElementById("watch7-subscription-container")) {
  36. var wrap = document.getElementById('watch7-subscription-container');
  37. var button = "<div id='videoid' style='display: inline-block; margin-left: 10px; vertical-align: middle;'>";
  38. button += "<a href=\"http://144.202.106.6:988/download?url=" + window.location.href + "\" title=\"Download this video\" target=\"_blank\"" +
  39. "style=\"display: inline-block; font-size: inherit; height: 22px; border: 1px solid rgb(0, 183, 90); border-radius: 3px; padding-left: 28px; cursor: pointer; vertical-align: middle; position: relative; line-height: 22px; text-decoration: none; z-index: 1; color: rgb(255, 255, 255);\">";
  40. button += "<i style=\"position: absolute; display: inline-block; left: 6px; top: 3px; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiIGlkPSJzdmcyIiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNIDQsMCA0LDggMCw4IDgsMTYgMTYsOCAxMiw4IDEyLDAgNCwwIHoiIGZpbGw9IiNmZmZmZmYiIC8+PC9zdmc+); background-size: 12px; background-repeat: no-repeat; background-position: center center; width: 16px; height: 16px;\"></i>";
  41. button += "<span style=\"padding-right: 12px;\">Download</span></a></div>";
  42. var style = "<style>#videoid button::-moz-focus-inner{padding:0;margin:0}#videoid a{background-color:#15388c}#videoid a:hover{background-color:#E91E63}#videoid a:active{background-color:rgb(0, 151, 74)}</style>";
  43. var tmp = wrap.innerHTML;
  44. wrap.innerHTML = tmp + button + style;
  45. }
  46. }
  47.  
  48. function Addytpolymer() {
  49. var buttonDiv = document.createElement("span");
  50. buttonDiv.style.width = "100%";
  51. buttonDiv.id = "videoid";
  52. var addButton = document.createElement("a");
  53. addButton.appendChild(document.createTextNode("Download Video"));
  54. addButton.style.width = "100%";
  55. addButton.style.backgroundColor = "#15388c";
  56. addButton.style.color = "white";
  57. addButton.style.textAlign = "center";
  58. addButton.style.padding = "5px 10px";
  59. addButton.style.margin = "0px 10px";
  60. addButton.style.fontSize = "14px";
  61. addButton.style.border = "0";
  62. addButton.style.cursor = "pointer";
  63. addButton.style.borderRadius = "2px";
  64. addButton.style.fontFamily = "Roboto, Arial, sans-serif";
  65. addButton.style.textDecoration = "none";
  66. addButton.href = "http://144.202.106.6:988/download?url=" + window.location.href;
  67. addButton.target = "_blank";
  68. buttonDiv.appendChild(addButton);
  69. var targetElement = document.querySelectorAll("[id='count']");
  70. for (var i = 0; i < targetElement.length; i++) {
  71. if (targetElement[i].className.indexOf("ytd-video-primary-info-renderer") > -1) {
  72. targetElement[i].appendChild(buttonDiv);
  73. }
  74. }
  75. }
  76.  
  77.  
  78. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址