Skip to content

Instantly share code, notes, and snippets.

@pedrolopesme
Created February 21, 2023 18:31
Show Gist options
  • Save pedrolopesme/1f1b858c1d166c050f64dc0d2146b4e3 to your computer and use it in GitHub Desktop.
Save pedrolopesme/1f1b858c1d166c050f64dc0d2146b4e3 to your computer and use it in GitHub Desktop.
Remove Youtube suggestions based on a word list
const words = ["lula", "bolsonaro"]
let peaceMaker = function() {
suggestions = document.getElementsByTagName('ytd-rich-item-renderer');
for (let i = 0; i < suggestions.length; i++) {
substrings = suggestions[i].getElementsByTagName('yt-formatted-string');
for (let ii = 0; ii < substrings.length; ii++) {
text = substrings[ii].textContent;
if(words.some(function(v) { return text.toLowerCase().indexOf(v) >= 0; })){
suggestions[i].remove();
}
}
}
}
setInterval(peaceMaker, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment