YouTube™ Video Downloader (1440p Update)

In just one page, you can now download your favorite videos on YouTube

  1. // ==UserScript==
  2. // @name YouTube™ Video Downloader (1440p Update)
  3. // @description In just one page, you can now download your favorite videos on YouTube
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.0
  6. // @author LazymanzoidYT (Design by Anpkal_Zuev)
  7. // @match https://www.youtube.com/*
  8. // @icon https://www.google.com/s2/favicons?domain=youtube.com
  9. // @grant GM_xmlhttpRequest
  10. // @compatible chrome
  11. // @compatible firefox
  12. // @compatible opera
  13. // @compatible edge
  14. // @compatible brave
  15. // @connect googuu.xyz
  16. // @connect loader.to
  17. // @connect oceansaver.in
  18. // @license MIT
  19. // ==/UserScript==
  20.  
  21. // Copyright (c) 2021 Anpkal Zuev, LazymanzoidYT and others
  22.  
  23. // Permission is hereby granted, free of charge, to any person obtaining
  24. // a copy of this software and associated documentation files (the
  25. // "Software"), to deal in the Software without restriction, including
  26. // without limitation the rights to use, copy, modify, merge, publish,
  27. // distribute, sublicense, and/or sell copies of the Software, and to
  28. // permit persons to whom the Software is furnished to do so, subject to
  29. // the following conditions:
  30.  
  31. // The above copyright notice and this permission notice shall be
  32. // included in all copies or substantial portions of the Software.
  33.  
  34. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  35. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  36. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  37. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  38. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  39. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  40. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  41.  
  42. window.onload = function() {
  43. var dark = !!document.getElementsByTagName("html")[0].getAttribute("dark");
  44. var downloadIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000" style="margin-top: 5px;"><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M13 5v6h1.17L12 13.17 9.83 11H11V5h2m2-2H9v6H5l7 7 7-7h-4V3zm4 15H5v2h14v-2z"></path></svg>`;
  45. if(dark){
  46. downloadIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"/></svg>`
  47. }
  48. var programSTATUS = 0;
  49. function startload(){
  50. var format= document.getElementById("formatus").value;
  51. var f= format;
  52. if(f=="8k"||f=="4k"||f=="1080"||f=="720"||f=="480"||f=="360"){
  53. f="mp4";
  54. }
  55. getFORMVIDEO(format,f);
  56. }
  57.  
  58.  
  59.  
  60. function updatepos(one,two){
  61. var reproz = 100/two;
  62. var ttproz = reproz*one;
  63. document.getElementById("download21").innerText = "Downloaded: "+Math.trunc(ttproz*10)/10+"%";
  64. if(Math.trunc(ttproz*10)/10 == 100){
  65. document.getElementById("download21").innerText="Download"
  66. }
  67. }
  68.  
  69. function getFORMVIDEO(format,fff){
  70. var link = `https://loader.to/ajax/download.php?start=1&end=1&format=`+format+`&url=`+encodeURI(window.location.href);
  71. GM_xmlhttpRequest({
  72. method: 'GET',
  73. url: link,
  74. responseType:"json",
  75. onload: function() {
  76. var ide = this.response.id;
  77. var gtitle = this.response.title
  78.  
  79. checkStatus();
  80. function checkStatus(){
  81. GM_xmlhttpRequest({
  82. method: 'GET',
  83. url: "https://loader.to/ajax/progress.php?id="+ide,
  84. responseType:"json",
  85. onload: function() {
  86. document.getElementById("download21").innerText="Downloading video from server: " + ""+this.response.progress/10+"%";
  87. if(this.response.text != "Downloaded."){
  88. setTimeout(()=>{checkStatus();},800);
  89. }else{
  90. download(this.response.download_url,gtitle,fff)
  91. }
  92. }
  93. });
  94. }
  95. }
  96. });
  97.  
  98. }
  99. function download(link,name,type){
  100. window.location.href = link;
  101. programSTATUS=0;
  102. document.getElementById("download21").innerText="Convert and Download ⬇️";
  103. /*
  104. GM_xmlhttpRequest({
  105. method: 'GET',
  106. url: link,
  107. responseType:"blob",
  108. onload: function() {
  109. console.log(1);
  110. save([this.response], name+"."+type);
  111. },
  112. onprogress:function(r) {
  113. updatepos(r.loaded,r.totalSize)
  114. }
  115. });
  116. */
  117. }
  118. var save = (function () {
  119. var a = document.createElement("a");
  120. document.body.appendChild(a);
  121. a.style = "display: none";
  122. return function (data, name) { programSTATUS=0;
  123. var blob = new Blob(data, {type: "octet/stream"}),
  124. url = window.URL.createObjectURL(blob);
  125. a.href = url;
  126. a.download = name;
  127. a.click();
  128. window.URL.revokeObjectURL(url);
  129. if(document.getElementById("ON125374").checked){
  130. showsettingsd();
  131. localStorage.setItem('ACLOSE154658', '1');
  132. }
  133. };
  134. }());
  135. var menu15 = `
  136. <div style="
  137. width: 250px;
  138. height: 89px;
  139. background-color: white;
  140. margin-left: calc(100vw/2 - 250px/2);
  141. margin-top: calc(100vh/2 - 89px/2);
  142. outline: 2px solid #000;
  143. padding: 0px;
  144. "><div style="height: 19px;">
  145. <div style="
  146. width: 84px;
  147. float: left;
  148. margin-left: 4px;
  149. margin-top: 2px;
  150. ">YouTube™ Video Downloader by Lazymanzoid</div><div style="
  151. width: 50px;
  152. float: left;
  153. margin-left: 4px;
  154. margin-top: 2px;
  155. margin-left: 46px;
  156. ">auto close</div><input type="checkbox" id="ON125374" style="
  157. margin-left: -1px;
  158. "><button id="slaves" style="
  159. border-radius: 0px;
  160. float: right;
  161. border-width: 2px;
  162. border: 0px;
  163. height: 19px;
  164. background-color: #e91e63;
  165. ">&nbsp;X&nbsp;</button></div><div style="
  166. height: 17px;
  167. "><select id="formatus" style="
  168. width: 250px;
  169. border-width: 0px;
  170. background-color: #fff;
  171. "><optgroup label="Audio">
  172. <option value="mp3">MP3</option>
  173. <option value="m4a">M4A</option>
  174. <option value="webm">WEBM</option>
  175. <option value="aac">AAC</option>
  176. <option value="flac">FLAC</option>
  177. <option value="opus">OPUS</option>
  178. <option value="ogg">OGG</option>
  179. <option value="wav">WAV</option>
  180. </optgroup><optgroup label="Video">
  181. <option value="360">MP4 (360 px)</option>
  182. <option value="480">MP4 (480 px)</option>
  183. <option value="720">MP4 (720p)</option>
  184. <option value="1080" selected="selected">MP4 (1080p)</option>
  185. <option value="1440">MP4 (1440p)</option>
  186. <option value="4k">WEBM (4K)</option>
  187. <option value="8k">WEBM (8K)</option></optgroup></select></div><button id="download21" style="
  188. border-radius: 0px;
  189. float: right;
  190. border-width: 2px;
  191. width: 100%;
  192. height: 53px;
  193. border: 0;
  194. ">Convert and Download ⬇️</button></div>
  195. `;
  196. function showsettingsd(){
  197. var lay = document.getElementsByClassName("15674821765123")[0];
  198. var pos = lay.style.display;
  199. lay.style.display = ( pos=="none" ? "block" : "none");
  200. }
  201. setListener();
  202. function setListener(){
  203. try{
  204. document.getElementById("slaves").onclick = function() {
  205. showsettingsd();
  206. };
  207. document.getElementsByClassName("14221212455")[0].onclick = function() {
  208. showsettingsd();
  209. };
  210. document.getElementById("download21").onclick = function() {
  211. if(!programSTATUS){
  212. startload();
  213. programSTATUS=1;
  214. }else{
  215. alert("The video is still loading..")
  216. }
  217. };
  218. document.getElementById("ON125374").onclick= function() {
  219. if(document.getElementById("ON125374").checked){
  220. localStorage.setItem('ACLOSE154658', '1');
  221. }else{
  222. localStorage.setItem('ACLOSE154658', '0');
  223. }
  224. };
  225. }catch{setTimeout(()=>{setListener();},500)}
  226. }
  227. let div = document.createElement("div");
  228. div.className = "14221212455";
  229. div.innerHTML = downloadIcon;
  230. try{setTimeout(()=>{document.getElementsByClassName("style-scope ytd-video-primary-info-renderer")[8].append(div);},1000);}
  231. catch{
  232. try{setTimeout(()=>{document.getElementsByClassName("style-scope ytd-video-primary-info-renderer")[8].append(div);},1000);}
  233. catch{
  234. setTimeout(()=>{document.getElementsByClassName("style-scope ytd-video-primary-info-renderer")[8].append(div);},1000);
  235. }
  236. }
  237. let div1 = document.createElement('div');
  238. div1.className = "15674821765123";
  239. div1.innerHTML = menu15;
  240. div1.style = `width: 100vw;background-color: #00000024;height: 100vh;position: fixed;right: 5px;display: none;z-index:99999999;`;
  241. document.body.prepend(div1);
  242.  
  243. if(!!Number(localStorage.getItem("ACLOSE154658"))){
  244. document.getElementById("ON125374").click();
  245. }
  246.  
  247. }