Youtube Video Actions

multiple actions for YouTube videos, such as downloading, opening in an external player, opening subtitles in another tab, opening in alternative pages, viewing the enlarged thumbnail and a few more things

  1. // ==UserScript==
  2. // @name Youtube Video Actions
  3. // @namespace violentmonkey.net
  4. // @version 1.2
  5. // @author Alexito
  6. // @match https://www.youtube.com/*
  7. // @include https://www.google.com/*
  8. // @include *://invidious.instances*
  9. // @include https://yewtu.be/*
  10. // @include https://invidious.flokinet.to/*
  11. // @include https://invidious.privacyredirect.com/*
  12. // @include https://invidious.privacydev.net/*
  13. // @include https://inv.nadeko.net/*
  14. // @grant GM_addStyle
  15. // @icon https://www.youtube.com/s/desktop/4e7ec2e0/img/favicon.ico
  16. // @description multiple actions for YouTube videos, such as downloading, opening in an external player, opening subtitles in another tab, opening in alternative pages, viewing the enlarged thumbnail and a few more things
  17. // @description:es múltiples acciones para videos de YouTube, como descargar, abrir en un reproductor externo, abrir subtítulos en otra pestaña, abrir en páginas alternativas, ver la miniatura ampliada y algunas cosas más
  18. // @license MIT feel free to modify improve and share
  19. // ==/UserScript==
  20.  
  21. // let style = document.createElement('style');
  22. // style.type = 'text/css';
  23. // style.innerHTML = "::placeholder {color:white;}input#nociv{position:fixed;color: white;padding: 0;text-align: center;width: 70px;height: 15px;z-index:9999;}";
  24. // document.body.appendChild(style);
  25. GM_addStyle(`::placeholder {color:white;}input#nociv{position:fixed;color: white;padding: 0;text-align: center;width: 70px;height: 15px;z-index:9999;}`);
  26. var links;
  27. let x, y;
  28. var origurl;
  29. var winmini;
  30. function actiona(){
  31. window.addEventListener("mousedown", actionb, false);
  32. };
  33.  
  34. function actionb(){
  35. links = document.querySelector("a:hover");
  36. var recta = links.parentNode.getBoundingClientRect();
  37. x = recta.left;
  38. y = recta.top;
  39. links.addEventListener("drag",function(){
  40. var putbuttons = document.querySelector("body > #nociv");
  41. if(links && !putbuttons){
  42. // GM_addStyle(`ytd-moving-thumbnail-renderer { display: none; }`);
  43. origurl = document.location.href;
  44. var Button1 = document.createElement("input");
  45. Button1.type = "text";
  46. Button1.value = "";
  47. Button1.placeholder = "Embed";
  48. Button1.style.top = y-0+"px";
  49. Button1.style.left = x-73+"px";
  50. Button1.addEventListener("input",function(){
  51. if(Button1.value.indexOf("watch?v=") > 1){
  52.  
  53. var link = Button1.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  54. // window.history.pushState(null, "", "https://www.youtube.com/watch?v="+link);
  55. if (winmini) {
  56. winmini.location.href = "https://www.youtube.com/embed/"+link;
  57. } else {
  58. var winmini = window.open( "https://www.youtube.com/embed/"+link,'wind1', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=318,left=390,top=800,modal=yes,dependent=yes");
  59. };
  60. // window.history.pushState(null, "", origlink);
  61. actionrem();
  62. actionwatched(link);
  63. };
  64. });
  65. var Button2 = document.createElement("input");
  66. Button2.type = "text";
  67. Button2.value = "";
  68. Button2.placeholder = "Invidious";
  69. Button2.style.top = y+18+"px";
  70. Button2.style.left = x-73+"px";
  71. Button2.addEventListener("input",function(){
  72. if(Button2.value.indexOf("watch?v=") > 1){
  73. const link = Button2.value.replace("www.youtube.com", "inv.nadeko.net"); //"inv.tux.pizza""invidious.materialio.us"" "invidious.flokinet.to""invidious.privacyredirect.com"
  74. window.open("" + link, "_blank");
  75. };
  76. });
  77. var Button3 = document.createElement("input");
  78. Button3.type = "text";
  79. Button3.value = "";
  80. Button3.placeholder = "Smplayer";
  81. Button3.style.top = y+36+"px";
  82. Button3.style.left = x-73+"px";
  83. Button3.addEventListener("input",function(){
  84. if(Button3.value.indexOf("watch?v=") > 1){
  85. const link = Button3.value.replace("https://", "");
  86. window.open("smplayer://" + link, "_self");
  87. };
  88. });
  89. var Button4 = document.createElement("input");
  90. Button4.type = "text";
  91. Button4.value = "";
  92. Button4.placeholder = "360p";
  93. Button4.style.top = y+54+"px";
  94. Button4.style.left = x-73+"px";
  95. Button4.addEventListener("input",function(){
  96. if(Button4.value.indexOf("watch?v=") > 1){
  97. const link = Button4.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  98. winmini = window.open( "https://inv.nadeko.net/latest_version?id="+link+"&itag=18",'wind1', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=318,left=390,top=800,modal=yes,dependent=yes");
  99. actionwatched(link);
  100. // setTimeout(() => {actionwatched(link)}, 1000);
  101.  
  102. };
  103. });
  104.  
  105. var Button5 = document.createElement("input");
  106. Button5.type = "text";
  107. Button5.value = "";
  108. Button5.placeholder = "720p";
  109. Button5.style.top = y+72+"px";
  110. Button5.style.left = x-73+"px";
  111. Button5.addEventListener("input",function(){
  112. if(Button5.value.indexOf("watch?v=") > 1){
  113. const link = Button5.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  114. var winmini = window.open( "https://invidious.perennialte.ch/latest_version?id="+link+"&itag=22",'wind1', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=318,left=390,top=800,modal=yes,dependent=yes");
  115. actionwatched(link);
  116. };
  117. });
  118. var Button6 = document.createElement("input");
  119. Button6.type = "text";
  120. Button6.value = "";
  121. Button6.placeholder = "Convert";
  122. Button6.style.top = y+126+"px";
  123. Button6.style.left = x-73+"px";
  124. Button6.addEventListener("input",function(){
  125. if(Button6.value.indexOf("watch?v=") > 1){
  126. const link = Button6.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  127. var winconvert = window.open( "https://tomp3.cc/youtube-downloader/" + link,'winconvert', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes,dependent=yes");
  128. };
  129. });
  130. var Button9 = document.createElement("input");
  131. Button9.type = "text";
  132. Button9.value = "";
  133. Button9.placeholder = "Subtitles";
  134. Button9.style.top = y+108+"px";
  135. Button9.style.left = x-73+"px";
  136. Button9.addEventListener("input",function(){
  137. if(Button9.value.indexOf("watch?v=") > 1){
  138. const link = Button9.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  139. var winsub = window.open( "https://invidious.fdn.fr/api/v1/captions/" + link + "?label=Spanish%20(auto-generated)",'wins1', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes,dependent=yes");
  140. };
  141. });
  142. var Button7 = document.createElement("input");
  143. Button7.type = "text";
  144. Button7.value = "";
  145. Button7.placeholder = "Deturl";
  146. Button7.style.top = y+162+"px";
  147. Button7.style.left = x-73+"px";
  148. Button7.addEventListener("input",function(){
  149. if(Button7.value.indexOf("watch?v=") > 1){
  150. const link = Button7.value.replace("", "");
  151. window.open("http://deturl.com/?url=" + link, "_blank");
  152. };
  153. });
  154. var Button8 = document.createElement("input");
  155. Button8.type = "text";
  156. Button8.value = "";
  157. Button8.placeholder = "Tubo";
  158. Button8.style.top = y+144+"px";
  159. Button8.style.left = x-73+"px";
  160. Button8.addEventListener("input",function(){
  161. if(Button8.value.indexOf("watch?v=") > 1){
  162. const link = Button8.value.replace("", "");
  163. window.open("https://tubo.migalmoreno.com/stream?url=" + link, "_blank");
  164. };
  165. });
  166. var Button10 = document.createElement("input");
  167. Button10.type = "text";
  168. Button10.value = "";
  169. Button10.placeholder = "Thumbnail";
  170. Button10.style.top = y+90+"px";
  171. Button10.style.left = x-73+"px";
  172. Button10.addEventListener("input",function(){
  173. if(Button10.value.indexOf("watch?v=") > 1){
  174. const link = Button10.value.replace(/.+\/shorts\//, '').replace(/.+v=/, '').slice(0, 11);
  175. // window.open("https://i.ytimg.com/vi/" + link + "/maxresdefault.jpg", "_blank"); //1280x720
  176. // window.open("https://i.ytimg.com/DtM_sw5nBfA/" + link + "/maxresdefault.webp", "_blank"); //1920x1080
  177. // window.open("https://inv.tux.pizza/vi/" + link +" /maxres.jpg";
  178. // var winthumb = window.open( "https://i.ytimg.com/vi/" + link + "/maxresdefault.jpg",'wint1', "location=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes,dependent=yes");
  179. var img = document.createElement("img");
  180. img.id = "imaginate";
  181. img.setAttribute("style", "position:fixed; top:0px; left:0px; overflow: hidden; z-index:9999;");
  182. img.src = "https://i.ytimg.com/vi/" + link + "/maxresdefault.jpg";
  183. // img.src = "https://inv.tux.pizza/vi/" + link +"/maxres.jpg";
  184. document.body.appendChild(img);
  185. };
  186. });
  187.  
  188. Button1.id = "nociv";
  189. Button2.id = "nociv";
  190. Button3.id = "nociv";
  191. Button4.id = "nociv";
  192. Button5.id = "nociv";
  193. Button6.id = "nociv";
  194. Button7.id = "nociv";
  195. Button8.id = "nociv";
  196. Button9.id = "nociv";
  197. Button10.id = "nociv";
  198. Button1.style.backgroundColor = "#1d6d1d";
  199. Button2.style.backgroundColor = "#135282";
  200. Button3.style.backgroundColor = "#8a4c0c";
  201. Button4.style.backgroundColor = "#067fa7";
  202. Button5.style.backgroundColor = "#5f335f";
  203. Button6.style.backgroundColor = "#9a0808";
  204. Button7.style.backgroundColor = "#126b6b";
  205. Button8.style.backgroundColor = "#8e617c";
  206. Button9.style.backgroundColor = "#1f409d";
  207. Button10.style.backgroundColor = "#197af3";
  208.  
  209. document.body.appendChild(Button1);
  210. document.body.appendChild(Button2);
  211. document.body.appendChild(Button3);
  212. document.body.appendChild(Button4);
  213. document.body.appendChild(Button5);
  214. document.body.appendChild(Button6);
  215. document.body.appendChild(Button7);
  216. document.body.appendChild(Button8);
  217. document.body.appendChild(Button9);
  218. document.body.appendChild(Button10);
  219. }
  220. });
  221. };
  222.  
  223. function actionrem(){
  224. document.querySelectorAll("[id='nociv']").forEach(function(a){a.remove()})
  225. // GM_addStyle(`ytd-moving-thumbnail-renderer { display: block; }`);
  226. };
  227. function actionremb(){
  228. document.querySelector("#imaginate").remove();
  229. };
  230. function actionwatched(link){
  231. if(location.href.indexOf("youtube.com") > 1){
  232. window.history.pushState(null, "", "https://www.youtube.com/watch?v="+link);
  233. setTimeout(() => {window.history.pushState(null, "", origurl)}, 100);
  234. };
  235. };
  236. window.addEventListener("dragend", actionrem, false);
  237. window.addEventListener("click", actionremb, false);
  238. actiona();
  239.  
  240. function funsionp(){
  241. if (window.location.href.indexOf("/embed/") > 1) {
  242. var vid = document.querySelector('video');
  243. if(vid){
  244. // if(!vid.src){
  245. document.querySelector("#movie_player > div.ytp-cued-thumbnail-overlay > button").click();
  246. } else {
  247. setTimeout(funsionp, 3000);
  248. };
  249. // };
  250. };
  251. };
  252. funsionp();
  253.  
  254.  
  255. ////////////////////////////////////////////////////// instances////////////////////////////////////////
  256.  
  257. // https://iv.ggtyler.dev/
  258. // https://invidious.perennialte.ch/
  259. // invidious.reallyaweso.me
  260. // https://invidious.jing.rocks/
  261. // https://invidious.nerdvpn.de/
  262. // https://inv.nadeko.net/
  263. // https://iv.nboeck.de/
  264. // https://vid.puffyan.us/
  265. // https://invidious.fdn.fr/
  266. // https://invidious.nerdvpn.de/
  267. // https://yt.artemislena.eu/
  268. // https://inv.us.projectsegfau.lt/
  269. // https://invidious.drgns.space/
  270. // https://invidious.einfachzocken.eu/
  271. // https://inv.n8pjl.ca/
  272. // https://vid.priv.au/
  273. // https://iv.melmac.space/
  274. // https://invidious.slipfox.xyz/
  275. // https://invidious.lunar.icu/
  276. // https://inv.in.projectsegfau.lt/
  277. // https://inv.tux.pizza/
  278. // https://inv.zzls.xyz/
  279. // https://iv.datura.network/
  280. // https://yt.drgnz.club/
  281. // https://invidious.protokolla.fi/
  282. // https://invidious.privacydev.net/
  283. // https://invidious.12a.app/
  284. // https://anontube.lvkaszus.pl/
  285. // https://invidious.privacyredirect.com/
  286. // https://yt.cdaut.de/
  287. // https://vid.lilay.dev/
  288. // https://invidious.private.coffee/
  289. // https://invidious.jing.rocks/
  290. // https://inv.oikei.net/
  291. // https://yt.artemislena.eu/
  292. // https://inv.nadeko.net/
  293. // https://invidious.projectsegfau.lt/
  294. // https://invidious.flokinet.to/
  295.  
  296.  
  297.  
  298.