Greasy Fork is available in English.
Deixa a interface do YouTube mais leve, some com a aba de shots e a abre o vídeo em uma página livre de anúncios e distrações.
当前为
// ==UserScript==
// @name YouTube Lite (Mó Paz)
// @namespace http://linkme.bio/jhonpergon/?userscript=youtube_lite
// @version 0.3
// @description Deixa a interface do YouTube mais leve, some com a aba de shots e a abre o vídeo em uma página livre de anúncios e distrações.
// @author Jhon Pérgon
// @match https://www.youtube.com/*
// @match https://youtu.be/*
// @match https://m.youtube.com/*
// @icon https://icons.iconarchive.com/icons/designbolts/cute-social-media/256/Youtube-icon.png
// @grant GM_addStyle
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Array de palavras-chave que você não deseja ver
var palavrasChave = ["funk", "MC", "Alok", "Champions", "Certanejo", "Mendonça", "Comédia","American","muambros", "Globinho","Podpah", "Golpista","MrBeast",
"Felipe Neto","Pica Pau", "Pica-Pau", "Rir", "Bob Esponja","Funny", "Naruto","Ronaldinho", "Neymar", "Gols", "Esgotinho Clips","Gospel",
"Goal","Galaxy","Iphone","TRAILERS", "Trailers", "Shelby", "Comprar", "Vender", "Restored", "Restaurando", "Pago", "Minecraft", "Kpop",
"Army","Opala","Ei Nerd","GOKU","Goku", "SAMSUNG","Samsung","Caio Teixeira","DRAGON","Ball","Pobre","Alanzoka","GAMEPLY","alanzoka","60FPS","FPS",
"HERÓI","Elite", "Jogos", "RTX","ULTRON","Anime","Cristiano Ronaldo","Life Media","Bonito","Jogar", "Jogo","Dragões","Kombat","KOMBAT",
"Kratos", "War", "Rusty","BEN 10", "Alpha","Redpill","Maquiagem","Gatos","Bolo","Casimito","Casemiro","DJ",
"Grupo Menos é Mais", "Você Sabia?", "Futbol", "Placar", "BBB", "Pepsi", "Coca Cola", "Talent","Pipoca","Garage", "Desenho Animado","COD",
"Produtos", "Produto", "Food", "Copa", "Faroeste", "Rodada", "Eliminatórias", "Favela", "Poesia Arcústica", "Renato Cariani", "4K"];
// Função para verificar se uma palavra-chave está presente em um elemento
function verificaPalavrasChave(elemento) {
var texto = elemento.textContent.toLowerCase();
for (var i = 0; i < palavrasChave.length; i++) {
var palavra = palavrasChave[i].toLowerCase();
if (texto.includes(palavra)) {
return true;
}
}
return false;
}
function getUrl(xxx) {
try {
if (typeof xxx !== 'string') {
throw new Error('Input is not a string');
}
const url = new URL(xxx);
const vParam = url.searchParams.get('v');
if (vParam) {
return vParam;
}
} catch (error) {
console.error('Erro ao obter o valor do parâmetro "v":', error);
}
return null;
}
// Função para remover tags "ytd-rich-item-renderer" com base nas palavras-chave
function removeTagsComPalavrasChave() {
var elementos = document.querySelectorAll("ytd-rich-item-renderer");
elementos.forEach(function (elemento) {
if (verificaPalavrasChave(elemento)) {
elemento.remove();
}
});
}
// Função para remover todas as tags
function removerTagsScript() {
document.title = "Youtube (Lite)";
setTimeout(function(){
const scripts = document.querySelectorAll('script');
scripts.forEach(function(script) {
script.parentNode.removeChild(script);
});
const tagthumbnails = document.querySelectorAll('ytd-playlist-thumbnail');
tagthumbnails.forEach(function(thumbnail) {
thumbnail.parentNode.removeChild(thumbnail);
});
const iconsets = document.querySelectorAll('iron-iconset-svg');
iconsets.forEach(function(iconset) {
iconset.parentNode.removeChild(iconset);
});
const renderers = document.querySelectorAll('ytd-rich-shelf-renderer');
renderers.forEach(function(renderer) {
renderer.parentNode.removeChild(renderer);
});
const recomendados = document.querySelectorAll('ytd-watch-next-secondary-results-renderer');
recomendados.forEach(function(recomendado) {
recomendado.parentNode.removeChild(recomendado);
});
const xplayers = document.querySelectorAll('ytd-player');
xplayers.forEach(function(player) {
player.parentNode.removeChild(player);
//console.log("ok")
});
const interactions = document.querySelectorAll('yt-interaction');
interactions.forEach(function(interaction) {
interaction.parentNode.removeChild(interaction);
//console.log("ok")
});
const players = document.querySelectorAll('video');
players.forEach(function(playerx) {
playerx.parentNode.removeChild(playerx);
});
// Obtém todos os elementos com o ID "video-preview"
const elementsToRemove = document.querySelectorAll('#video-preview');
// Itera sobre os elementos e os remove
for (const element of elementsToRemove) {
element.remove();
}
const links = document.querySelectorAll('a');
for (const link of links) {
link.style.border = '1px solid transparent';
link.addEventListener('mouseover', function() {
link.style.border = '1px solid #9ba2ff';
link.style.boxShadow = '2px 3px 4px #5c3299';
});
link.addEventListener('mouseout', function() {
link.style.border = '1px solid transparent';
link.style.boxShadow = '';
});
if (link.href.indexOf('/watch?v=') !== -1) {
console.log(link.href)
let linkID = getUrl(link.href);
console.log(linkID)
link.setAttribute('href', `https://www.youtube-nocookie.com/embed/${linkID}?rel=0&controls=2&color=white&iv_load_policy=3&showinfo=0&modestbranding=1&hl=pt-BR&autoplay=1`);
}
//const clonedLink = link.cloneNode(true);
//link.parentNode.replaceChild(clonedLink, link);
}
}, 500);
}
// Função para extrair o ID do vídeo da URL
function getVideoIdFromUrl() {
const url = window.location.href;
const match = url.match(/[?&]v=([^&]+)/);
if (match && match[1]) {
return match[1];
}
return null;
}
// Função para criar o iframe personalizado
function createCustomIframe(videoId) {
// Remove todo o conteúdo da <body>
document.body.style.backgroundColor = "#06070b";
//document.body.innerHTML = '';
document.body.style.backgroundColor = "#06070b";
setTimeout(function(){
//Remover eventos pré-estabelecidos
const cinematicsContainer = document.getElementById('cinematics-container');
if (cinematicsContainer) {
const clonedElement = cinematicsContainer.cloneNode(true);
cinematicsContainer.parentNode.replaceChild(clonedElement, cinematicsContainer);
}
const playerContainer = document.getElementById('player');
if (playerContainer) {
const clonedElement = playerContainer.cloneNode(true);
playerContainer.parentNode.replaceChild(clonedElement, playerContainer);
}
let mainplayer = document.getElementById('cinematics-container');
let interfacex = document.getElementById('primary');
let menus = document.getElementById('menu');
let columns = document.getElementById('chat-container');
if (mainplayer) {
columns.innerHTML = ``;
//alert("trocou: "+localStorage.getItem('trocou')+" trocardeNovo: "+localStorage.getItem('trocardeNovo'))
if(localStorage.getItem('atualReload') == "false" && localStorage.getItem('trocou') == "false" && localStorage.getItem('trocardeNovo') == "true"){
mainplayer.innerHTML = ``;
localStorage.setItem('trocou', "true");
//alert("LIMPOU")
}
if(localStorage.getItem('atualReload') == "false" && localStorage.getItem('trocou') == "true" && localStorage.getItem('trocardeNovo') == "true"){
localStorage.setItem('trocardeNovo', "false");
//alert("ADD IFRAME")
mainplayer.style.width = '98%';
mainplayer.style.maxWidth = '720px';
mainplayer.style.height = '85%';
mainplayer.style.maxHeight = '450px';
interfacex.style.maxWidth = '720px';
interfacex.style.height = 'auto';
interfacex.style.maxHeight = '450px';
interfacex.style.position = 'absolute';
interfacex.style.marginLeft = '0px';
interfacex.style.marginRight = '0px';
interfacex.style.right = '50%';
interfacex.style.left = '50%';
interfacex.style.bottom = '0';
interfacex.style.top = '10px';
interfacex.style.transform = 'translate(-50%, 0%)';
setTimeout(function(){
//alert("Pronto")
mainplayer.innerHTML = `<iframe id="xplayer" src="https://www.youtube-nocookie.com/embed/${videoId}?rel=0&controls=2&color=white&iv_load_policy=3&showinfo=0&modestbranding=1&hl=pt-BR" allow="accelerometer; autoplay; gyroscope; picture-in-picture" frameborder="0" frameborder="autoplay" scrolling="no" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer" allowfullscreen=""></iframe>`;
let customIframe = document.getElementById('xplayer');
customIframe.style.width = '720px';
customIframe.style.maxWidth = '95%';
customIframe.style.height = '98%';
customIframe.style.maxHeight = '420px';
customIframe.style.border = 'solid 1px #413746';
customIframe.style.borderRadius = '.6rem';
customIframe.style.position = 'absolute';
customIframe.style.right = '50%';
customIframe.style.left = '50%';
customIframe.style.transform = 'translate(-50%, 30px)';
customIframe.style.zIndex = '1000';
customIframe.style.backgroundImage = "url(https://i.pinimg.com/originals/cf/ce/2f/cfce2fa4cc0ccdc49cf1482c355a50b8.gif)";
menus.innerHTML = `<div style="width: 70px; height: 18px; padding: 10px 30px; overflow: hidden; margin: 5px; background-color: #2a292b; border: 1px solid #afc2ff; border-radius: 2em;"><a style="text-decoration: none; padding: 10px 30px; margin-left: -30px; color: rgb(246, 241, 255); font-size: 1.6rem;" href="https://www.y2mate.com/pt/youtube/${videoId}" target="_blank">Download</a><div>`;
}, 500);
localStorage.setItem('atualReload', "true");
}else if(localStorage.getItem('atualReload') == "true"){
mainplayer.innerHTML = ``;
mainplayer.style.width = '98%';
mainplayer.style.maxWidth = '720px';
mainplayer.style.height = '85%';
mainplayer.style.maxHeight = '450px';
interfacex.style.maxWidth = '720px';
interfacex.style.height = 'auto';
interfacex.style.maxHeight = '450px';
interfacex.style.position = 'absolute';
interfacex.style.marginLeft = '0px';
interfacex.style.marginRight = '0px';
interfacex.style.right = '50%';
interfacex.style.left = '50%';
interfacex.style.bottom = '0';
interfacex.style.top = '10px';
interfacex.style.transform = 'translate(-50%, 0%)';
setTimeout(function(){
mainplayer.innerHTML = `<iframe id="xplayer" src="https://www.youtube-nocookie.com/embed/${videoId}?rel=0&controls=2&color=white&iv_load_policy=3&showinfo=0&modestbranding=1&hl=pt-BR&autoplay=1" allow="accelerometer; autoplay; gyroscope; picture-in-picture" frameborder="0" frameborder="autoplay" scrolling="no" autoplay="autoplay" sandbox="allow-scripts allow-same-origin" referrerpolicy="no-referrer" allowfullscreen=""></iframe>`;
let customIframe = document.getElementById('xplayer');
customIframe.style.width = '720px';
customIframe.style.maxWidth = '95%';
customIframe.style.height = '98%';
customIframe.style.maxHeight = '420px';
customIframe.style.border = 'solid 1px #413746';
customIframe.style.borderRadius = '.6rem';
customIframe.style.position = 'absolute';
customIframe.style.right = '50%';
customIframe.style.left = '50%';
customIframe.style.transform = 'translate(-50%, 30px)';
customIframe.style.zIndex = '1000';
customIframe.style.backgroundImage = "url(https://i.pinimg.com/originals/cf/ce/2f/cfce2fa4cc0ccdc49cf1482c355a50b8.gif)";
menus.innerHTML = `<div style="width: 70px; height: 18px; padding: 10px 30px; overflow: hidden; margin: 5px; background-color: #2a292b; border: 1px solid #afc2ff; border-radius: 2em;"><a style="text-decoration: none; padding: 10px 30px; margin-left: -30px; color: rgb(246, 241, 255); font-size: 1.6rem;" href="https://www.y2mate.com/pt/youtube/${videoId}" target="_blank">Download</a><div>`;
}, 500);
}
}else{
alert("O Youtube Lite Falhou, vamos atualizar a página. (Se está vendo isso com frequênicia, verifique se há uma nova versão desse userscript)")
}
// Altera o título da página para "Youtube Lite"
document.title = "Youtube (Lite)";
}, 2200);
}
// Impedir a abertura do vídeo normal
function impedirReproducaoAutomatica() {
if(trocardeNovo == true){
HTMLMediaElement.prototype.play = function() {
console.log("A chamada ao método play() foi bloqueada.");
// Você pode escolher não fazer nada aqui ou adicionar um comportamento personalizado
}
}
}
// Função para verificar a URL a cada 2 segundos
function checkURL() {
//impedirReproducaoAutomatica();
removerTagsScript();
removeTagsComPalavrasChave();
const currentURL = window.location.href;
if (currentURL !== localStorage.getItem('lastCheckedURL') && currentURL.includes("/watch?v=")) {
window.location.reload();
localStorage.setItem('lastCheckedURL', currentURL);
localStorage.setItem('trocou', "false");
localStorage.setItem('trocardeNovo', "true");
localStorage.setItem('atualReload', "false");
const videoId = getVideoIdFromUrl();
if (videoId) {
createCustomIframe(videoId);
}
}
}
// Inicia o loop para verificar a URL a cada 1 segundos
setInterval(checkURL, 1000);
// Verifica a URL quando o script é carregado pela primeira vez
const videoId = getVideoIdFromUrl();
if (videoId) {
createCustomIframe(videoId);
}
})();