// ==UserScript== dislikes, auto repeat vid // @name Youtube Tools All in one local download mp3 mp4 HIGT QUALITY return dislikes and more // @name:zh-TW 本地 YouTube 下載器 // @name:zh-HK 本地 YouTube 下載器 // @name:zh-CN 本地 YouTube 下载器 // @name:ja ローカル YouTube ダウンローダー // @name:kr 로컬 YouTube 다운로더 // @name:ar Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:bg Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:cs Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:da Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:de Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:el Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:eo Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:es Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:fi Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:fr Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:fr-CA Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:he Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:hu Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:id Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:it Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:ko Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:nb Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:nl Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:pl Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:pt-BR Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:ro Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:ru Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:sk Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:sr Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:sv Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:th Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:tr Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:uk Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:ug Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @name:vi Youtube Tools All in one local Download MP4, MP3 HIGT QUALITY without external service and more. // @description Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:ar Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:bg Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:da Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:de Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:el Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:eo Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:fi Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:fr-CA Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:he Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:hu Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:id Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:it Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:ko Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:nb Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:nl Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:pl Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:pt-BR Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:ro Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:ru Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:sk Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:sr Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:sv Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:th Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:tr Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:uk Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:ug Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:vi Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @homepage https://github.com/DeveloperMDCM/ // @version 1.4 // @description Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @description:zh-TW 無需第三方服務即可下載 YouTube 視頻等。 // @description:zh-HK 無需第三方服務即可下載 YouTube 視頻等 // @description:zh-CN 无需通过第三方服务等即可下载 YouTube 视频 // @description:ja 外部サービスなどを使わずに YouTube 動画をダウンロード // @description:kr 외부 서비스 등 없이 YouTube 동영상 다운로드 // @description:fr Obtenez un lien brut de YouTube sans service externe. et de plus // @description:cs Stahujte videa z YouTube bez externích služeb. a více // @description:en Download MP4, MP3 HIGT QUALITY without external services. and more // @description:es Youtube Tools All in one local Download mp4, MP3 HIGT QUALITY without external service auto repeat video, skip ads, return dislikes and more // @author MDCM // @match https://*.youtube.com/* // @exclude *://music.youtube.com/* // @exclude *://*.music.youtube.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com // @grant GM_info // @grant GM_setValue // @grant GM_getValue // @grant unsafeWindow // @run-at document-end // @compatible chrome // @compatible firefox // @compatible opera // @compatible safari // @compatible edge // @license MIT // @namespace https://github.com/DeveloperMDCM/ // @downloadURL none // ==/UserScript== (function () { // Youtube tools by: DeveloperMDCM // https://github.com/DeveloperMDCM/Youtube-tools-extension "use strict"; function paramsVideoURL() { const parametrosURL = new URLSearchParams(window.location.search); // Url parametros return parametrosURL.get("v"); } function cargarScript() { console.log("Scrip en ejecución by: DeveloperMDCM MDCM"); //alert('Script by: DeveloperMDCM') let ad = true; // Menu Buttons const menuBotones = `
`; const addDislike = document.createElement("P"); // Texto count dislikes let validoBotones = true; // TODO: Inicia y inserta los botones setInterval(() => { // se repite 1 vez const addButton = document.querySelector(".style-scope .ytd-watch-metadata"); if (addButton != undefined && validoBotones) { validoBotones = false; addButton.insertAdjacentHTML("beforebegin", menuBotones); document.querySelector("video").style.borderRadius = "30px"; // Formulario de botones para descargar const formulariodescarga = document.querySelector(".formulariodescarga"); const formulariodescargaaudio = document.querySelector(".formulariodescargaaudio"); const framedescarga = document.querySelector("#descargando"); const framedescargamp3 = document.querySelector("#descargandomp3"); formulariodescarga.addEventListener('click', e=> { e.preventDefault(); }); formulariodescargaaudio.addEventListener('click', e=> { e.preventDefault(); }); const btn1mp4 = document.querySelector(".btn1"); const btn2mp3 = document.querySelector(".btn2"); const btn3cancel = document.querySelector(".btn3"); const selectcalidades = document.querySelector(".selectcalidades"); const selectcalidadesaudio = document.querySelector(".selectcalidadesaudio"); selectcalidades.addEventListener("change", (e) => { framedescarga.src = `https://loader.to/api/button/?url=${window.location.href}&f=${e.target.value}&color=0af`; framedescarga.classList.remove("ocultarframe"); }); selectcalidadesaudio.addEventListener("change", (e) => { framedescargamp3.src = `https://loader.to/api/button/?url=${window.location.href}&f=${e.target.value}&color=049c16`; console.log(e.target.value) framedescargamp3.classList.remove("ocultarframeaudio"); }); btn3cancel.onclick = () => { formulariodescarga.style.display = "none" formulariodescargaaudio.style.display = "none" } btn1mp4.onclick = () => { selectcalidades.classList.remove("ocultarframe"); framedescarga.classList.add("ocultarframe"); formulariodescarga.classList.remove("ocultarframe"); formulariodescarga.style.display = "" selectcalidadesaudio.classList.add("ocultarframeaudio"); formulariodescargaaudio.classList.add("ocultarframe"); formulariodescarga.reset(); }; btn2mp3.onclick = () => { formulariodescargaaudio.classList.remove("ocultarframe"); formulariodescarga.classList.add("ocultarframe"); framedescargamp3.classList.remove("ocultarframeaudio"); formulariodescargaaudio.style.display = "" selectcalidadesaudio.classList.remove("ocultarframeaudio"); framedescargamp3.classList.add("ocultarframeaudio") formulariodescargaaudio.reset(); }; const reverse = document.querySelector("#columns"); // Invertir contenido const btnReset = document.querySelector("#reset"); // Reset button const InputColor = document.querySelector("#color"); // Input color const btnImagen = document.querySelector("#imagen"); // Download image video const formularioButtons = document.querySelector("#eyes"); // Filtro de pantalla const btnFondo = document.querySelector("#fondo"); // Fondo cinematica completa const invertirVista = document.querySelector("#invertir"); // Intercambiar vista const buttonsVideo = document.querySelector( "#top-row.ytd-watch-metadata" ); // Botones para video reverse.style.flexDirection = "row"; buttonsVideo.style = "display: flex;flex-direction: column;justify-content: center;align-items: center ;"; document.querySelector("#title > h1").style = "text-align: center; color: red;"; document.querySelector("#owner").style.justifyContent = "center"; document.querySelector("#search-icon-legacy.ytd-searchbox").style.backgroundColor = "black"; let countViewRow = 0; // Count invertirVista.onclick = () => { countViewRow += 1; switch (countViewRow) { case 1: reverse.style.flexDirection = "row-reverse"; break; case 2: reverse.style.flexDirection = "row"; countViewRow = 0; break; } }; // valido modo oscuro y venta de video // Repeat video button let countRepeat = 0; // count const repeat = document.querySelector("#repeatvideo"); // Repeat button const imarepeat = document.querySelector(".imarepeat"); // img repeat const videoFull = document.querySelector("#movie_player > div.html5-video-container > video") repeat.onclick = () => { if(document.querySelector("#cinematics > div") != undefined || videoFull != undefined){ countRepeat += 1; setInterval(() => { const videoRepeat = document.querySelector("video"); // vIDEO PLAYER let aux = videoRepeat.duration - 2; const buttonLeft = document.querySelector("#movie_player > div.ytp-chrome-bottom > div.ytp-chrome-controls > div.ytp-left-controls > a.ytp-prev-button.ytp-button"); switch (countRepeat) { case 1: if (videoRepeat.duration) { if (videoRepeat.currentTime >= aux) { videoRepeat.currentTime = 0; buttonLeft.click(); } imarepeat.src = "https://cdn-icons-png.flaticon.com/512/3447/3447552.png"; // img repeat } break; case 2: countRepeat = 0; imarepeat.src = "https://cdn-icons-png.flaticon.com/512/3447/3447562.png"; break; } }, 1000); }else { mostrarAlerta('Active Dark Theme in Youtube page') } }; // Background transparent btnFondo.onclick = function () { if(document.querySelector("#cinematics > div") != undefined && videoFull != undefined){ document.querySelector("#cinematics > div").style = "position: fixed; inset: 0px; pointer-events: none; transform: scale(1.5, 2)"; document.querySelector("#cinematics > div > canvas:nth-child(1)").style = "position: absolute; width: 100%; height: 100vh;"; document.querySelector("#cinematics > div > canvas:nth-child(2)").style = "position: absolute; width: 100vw; height: 100%; opacity: 0.2;"; document.querySelector("html[dark] [dark]").style.backgroundColor = "transparent"; document.body.style.setProperty("--yt-spec-general-background-a", "transparent"); document.querySelector("ytd-playlist-panel-renderer[modern-panels]:not([within-miniplayer]) #container.ytd-playlist-panel-renderer").style = "border: 3px solid red; background-color: #352e2e29"; }else if(document.querySelector("#cinematics > div") === null) { alert('NOT support live video') } else { mostrarAlerta('Active Dark Theme in Youtube page') } }; btnReset.addEventListener('click', function () { if(document.querySelector("#cinematics > div") != undefined || videoFull != undefined){ document.body.style.setProperty("--yt-spec-text-primary","#ffffff"); // document.body.style.setProperty('--yt-spec-text-secondary', '#ffffff'); document.body.style.setProperty("--yt-spec-static-overlay-background-brand", "#ffffff"); document.body.style.setProperty("--yt-spec-static-overlay-background-brand", "red"); if(document.querySelector("#cinematics > div") != null) { document.querySelector("#cinematics > div").style = "position: relative; inset: 0px; pointer-events: none; background: transparent"; } document.body.style.setProperty("--yt-spec-static-brand-red", "#ff0000"); document.body.style.setProperty("--yt-spec-static-brand-white", "gray"); document.querySelector("#ojosprotect").style.backgroundColor = "transparent"; document.body.style.setProperty("--ytd-searchbox-legacy-border-color", "#ffffff"); document.body.style.setProperty("--ytd-searchbox-legacy-border-shadow-color", "#ffffff"); document.querySelector("#logo-icon").style.color = "#ffffff"; document.body.style.setProperty("--yt-spec-general-background-a", "#000000"); document.querySelector("html[dark] [dark]").style.backgroundColor = "#000000"; document.querySelector("ytd-playlist-panel-renderer[modern-panels]:not([within-miniplayer]) #container.ytd-playlist-panel-renderer").style = ""; } else { mostrarAlerta('Active Dark Theme in Youtube page') } }) reverse.style.flexDirection = "row"; btnImagen.onclick = () => { if(document.querySelector("#cinematics > div") != undefined || videoFull != undefined){ const parametrosURL = new URLSearchParams(window.location.search); // Url parametros let enlace; enlace = parametrosURL.get("v"); window.open( `https://i.ytimg.com/vi/${enlace}/maxresdefault.jpg`, "popUpWindow", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes" ); }else { mostrarAlerta('Active Dark Theme in Youtube page') } }; // Input color InputColor.addEventListener("input", function () { if(document.querySelector("#cinematics > div") != undefined || videoFull != undefined){ document.body.style.setProperty("--yt-spec-text-primary", InputColor.value); document.body.style.setProperty("--yt-spec-text-secondary", "#ffffff"); document.body.style.setProperty("--yt-spec-static-overlay-background-brand", "red"); document.body.style.setProperty("--yt-spec-static-brand-red", InputColor.value); document.body.style.setProperty("--yt-spec-static-brand-white", InputColor.value); document.body.style.setProperty("--ytd-searchbox-legacy-border-color", InputColor.value); document.body.style.setProperty("--ytd-searchbox-legacy-border-shadow-color", InputColor.value); document.querySelector("#logo-icon").style.color = InputColor.value; document.querySelector("#subscribe-button > ytd-subscribe-button-renderer > yt-button-shape > button").style = "color: black; background-color: white; border: 2px solid black; "; }else { mostrarAlerta('Active Dark Theme in Youtube page') } }); // Filtro de pantalla formularioButtons.addEventListener("input", function () { if(document.querySelector("#cinematics > div") != undefined || videoFull != undefined){ document.querySelector("#ojosprotect").style.backgroundColor = formularioButtons.value; }else { mostrarAlerta('Active Dark Theme in Youtube page') } }); } // }, 1000); // Termina setIterval // Función para link github project const existeFormButton = document.querySelector("#below > ytd-watch-metadata > div.container > form"); function MDCM() { if (!existeFormButton) { const mdcm = document.querySelector("#MDCM"); const sms = document.querySelector("#below > ytd-watch-metadata"); if (!mdcm) { if (sms != undefined) { const mdcm = document.createElement("P"); mdcm.innerHTML = 'GitHub Repository

'; sms.appendChild(mdcm); } } } } // Función para adaptar dislikes let validoUrl = document.location.href; async function cargarDislikes() { const enlace = paramsVideoURL(); validoUrl = document.location.href; const btnDislike = document.querySelector("#segmented-dislike-button yt-button-shape > button"); const validoVentana = document.querySelector("#below > ytd-watch-metadata > div.container > form > div.containerButtons"); const resultado = document.querySelector("#segmented-dislike-button > ytd-toggle-button-renderer > yt-button-shape > button > yt-touch-feedback-shape"); if ( validoUrl.split("/")[3] !== "shorts" && validoVentana != undefined && validoUrl != "https://www.youtube.com/" ) { const url = `https://returnyoutubedislikeapi.com/Votes?videoId=${enlace}`; try { const respuesta = await fetch(url); const datos = await respuesta.json(); const { dislikes, dateCreated, rating } = datos; // Objeto addDislike.textContent = `${FormatiarNumero(dislikes, 0)}`; btnDislike.style = "width: 100px"; resultado.style = "margin: 0 6px"; resultado.insertAdjacentElement("afterend", addDislike); const iconLike = document.querySelector("#segmented-like-button > ytd-toggle-button-renderer > yt-button-shape > button > div.yt-spec-button-shape-next__icon > yt-icon > yt-animated-icon"); const inconDislike = document.querySelector("#segmented-dislike-button > ytd-toggle-button-renderer > yt-button-shape > button > div > yt-icon"); if (iconLike != undefined && iconLike != inconDislike) { document.querySelector("#segmented-like-button > ytd-toggle-button-renderer > yt-button-shape > button > div.yt-spec-button-shape-next__icon > yt-icon > yt-animated-icon").innerHTML = ` `; document.querySelector("#segmented-dislike-button > ytd-toggle-button-renderer > yt-button-shape > button > div > yt-icon").innerHTML = ` `; } } catch (error) { // Error console.log(error); } } } // Función para formatear los dislikes function FormatiarNumero(num, digits) { const lookup = [{ value: 1, symbol: "", }, { value: 1e3, symbol: " K", }, { value: 1e6, symbol: " M", }, ]; const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; const item = lookup .slice() .reverse() .find((item) => { return num >= item.value; }); return item ? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol : "0"; } // Función para mostrar los dislikes en shorts async function shortDislike() { validoUrl = document.location.href; const validoVentanaShort = document.querySelectorAll( "#dislike-button > yt-button-shape > label > div > span" ); if ( validoVentanaShort != undefined && document.location.href.split("/")[3] === "shorts" ) { validoUrl = document.location.href.split("/")[4]; const urlShorts = `https://returnyoutubedislikeapi.com/Votes?videoId=${validoUrl}`; try { const respuesta = await fetch(urlShorts); const datosShort = await respuesta.json(); const { dislikes } = datosShort; for (var i = 0; i < validoVentanaShort.length; i++) { validoVentanaShort[i].textContent = `${FormatiarNumero( dislikes, 0 )}`; } } catch (error) { console.log(error); } } } // Mostrar alerta de activar modo oscuro function mostrarAlerta(mensaje) { alert('Active Dark Theme in Youtube page') const addButton = document.querySelector( "#below > ytd-watch-metadata > div.container > form" ); const existeAlerta = document.querySelector(".alerta"); if (!existeAlerta) { if (addButton != undefined) { const modeDark = document.createElement("P"); modeDark.innerHTML = `

${mensaje}

`; addButton.appendChild(modeDark); setTimeout(() => { modeDark.remove(); }, 7000); } } } // Función para eliminar los posibles anuncios function eliminarAnuancios() { // Skip ads video / saltar publicidad const buttonSkip = document.querySelector(".ytp-ad-skip-button.ytp-button"); const validar = undefined; let ytpminiplayerscrim = document.querySelector("ytp-miniplayer-scrim"); let cross = document.getElementsByClassName("ytp-ad-overlay-close-container")[0]; let skip = document.getElementsByClassName("ytp-ad-skip-button")[0]; let ad1 = document.querySelector("#contents > ytd-promoted-sparkles-web-renderer"); let ad2 = document.querySelector("#player-ads > ytd-player-legacy-desktop-watch-ads-renderer"); let ad3 = document.querySelector("#action-companion-click-target"); let ad4 = document.querySelector("#player-overlay\\:0 > div.ytp-ad-player-overlay-flyout-cta.ytp-ad-player-overlay-flyout-cta-rounded"); let ad5 = document.querySelector("#invideo-overlay\\:0 > div > div.ytp-ad-image-overlay"); let ad6 = document.querySelector("#root"); let ad7 = document.querySelector("#rendering-content > ytd-video-masthead-ad-v3-renderer"); let ad8 = document.querySelector("#player-ads > ytd-player-legacy-desktop-watch-ads-renderer"); let ad9 = document.querySelector(".ytp-ad-text-overlay"); const adVideo = document.querySelectorAll(".ad-showing")[0]; const adTimeVideo = document.querySelector(".ytp-ad-text.ytp-ad-preview-text"); const video = document.querySelector("video"); if (adVideo != validar && video != validar && adTimeVideo != validar) { video.currentTime = video.duration; } if (ytpminiplayerscrim != validar) alert("eliminado"); if (ad1 != validar) ad1.remove(); if (ad2 != validar) ad2.remove(); if (ad3 != validar) ad3.remove(); if (ad4 != validar) ad4.remove(); if (ad5 != validar) ad5.remove(); if (ad6 != validar && ad) { ad6.style.display = "none"; ad = false; } if (ad7 != validar) ad7.remove(); if (ad8 != validar) ad8.remove(); if (ad9 != validar) ad9.remove(); if (cross != validar) cross.click(); if (skip != validar) skip.click(); if (buttonSkip != validar) { buttonSkip.click(); } } // Validar que la url a cambiado por una nueva let prevUrl = undefined; // Sin cambios setInterval(() => { // URL changed / Cambio const currUrl2 = window.location.href; const video = document.querySelector("#movie_player > div.html5-video-container > video") if (currUrl2 != prevUrl && video != undefined) { cargarDislikes(); console.log('link actualizado') } const currUrl = window.location.href; if (currUrl != prevUrl) { MDCM(); setTimeout(() => { shortDislike(); }, 1000) const formulariodescarga = document.querySelector(".formulariodescarga"); setTimeout(() => { if (formulariodescarga != undefined) { formulariodescarga.classList.add("ocultarframe"); } }, 500); prevUrl = currUrl; setTimeout(() => { cargarDislikes(); }, 1000) } const ventanaShortComentarios = document.querySelector("body > ytd-app > ytd-popup-container > tp-yt-paper-dialog > ytd-engagement-panel-section-list-renderer"); const historias = document.querySelectorAll("#shorts-inner-container"); if (ventanaShortComentarios && historias) { limpiarHTML(); } eliminarAnuancios(); }, 500); // Cada 2 segundos se ejecuta mientras la url cambie eliminarAnuancios(); } // Variables para la traduccion de comentarios let traducido; // Texto traducido let urlLista; // Url lista //TODO: Traducir comentarios async function traductor() { const texto = document.querySelectorAll("#content-text"); let o = `?client=dict-chrome-ex&sl=auto&tl=${navigator.language}&q=`; for (let i = 0; i < texto.length; i++) { const botonTraducir = document.createElement("BUTTON"); botonTraducir.classList.add("mdcm"); botonTraducir.textContent = "Traducir"; botonTraducir.style.backgroundColor = "white"; botonTraducir.style.color = "black"; botonTraducir.style.borderRadius = "5px"; botonTraducir.setAttribute("id", `btn${i}`); texto[i].insertAdjacentElement("afterend", botonTraducir); const mdcm = document.querySelectorAll(`.mdcm`); mdcm[i].onclick = function () { traducido = o; urlLista = traducido + texto[i].textContent; fetch("https://translate.googleapis.com/translate_a/t" + urlLista) //API .then((response) => response.json()) .then((datos) => { texto[i].textContent = datos[0][0]; mdcm[i].textContent = "Traducido"; }); }; } } // Limpiar botones de comentarios function limpiarHTML() { const buttons = document.querySelectorAll(".mdcm"); [].forEach.call(buttons, function (buttons) { buttons.remove(); }); traductor(); } // TODO: mostrar boton de traducir en comentarios cuando sean visibles window.onscroll = () => { const divEl = document.querySelector("#content-text"); if (divEl != undefined) { limpiarHTML(); } }; setTimeout(() => { cargarScript(); }, 1500); })();