Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
Removing the comment section from the youtube video page

im trying to make a Userscript that removes the comments from the Youtube video page but cant get it to work i tried a lot of methods but keep getting different errors that lead into other errors and stuff

window.addEventListener('load', (event) => {
setTimeout(function(){
  document.document.querySelector("#comments")[0].remove()
}, 2000);
  });

i also tried this version

(function () {
    window.addEventListener('load', function () {
      setTimeout(() => {(function () {
        var CommentSection = document.querySelector("#comments");
        if (CommentSection) {
          CommentSection.parentNode.removeChild(CommentSection);
        }
      })})
    }, false);
    console.log("should be removed //")
  })()

but both give errors the hard thing is that the comments dont load immediately but load slowly and separately

thanks in advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Inserting a CSS rule that hides the section would be easier.

document.body.appendChild(document.createElement('style')).textContent = '.ytd-comments { display: none; }';

The .ytd-comments is the container for all the comments on a video, so setting it to display: none will hide it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda