Skip to content

Instantly share code, notes, and snippets.

@sprngr
Created January 22, 2018 02:06
Show Gist options
  • Save sprngr/d070711eca2cb08eaba37c743bc6ad7f to your computer and use it in GitHub Desktop.
Save sprngr/d070711eca2cb08eaba37c743bc6ad7f to your computer and use it in GitHub Desktop.
Removes specified channels from showing up in your YouTube results
// ==UserScript==
// @name YouTube Channel Results Filter
// @version 0.2
// @description Removes specified channels from showing up in your YouTube results
// @author sprngr
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
window.onload = (function() {
'use strict';
// Using Markiplier as an example here. Supports YouTube username or channel hash that can be found in the link back to a profile.
// Searches for instances of links back to a profile, and removes the parent container. Polls every 500ms to check due to autoloads.
var channelList = ['markiplierGAME'];
var removeResultsForChannel = function(channel) {
var channelResults = document.querySelectorAll('[href*="/' + channel + '"]');
channelResults.forEach(function(channel) {
console.log("removing video");
channel.closest('ytd-video-renderer, ytd-playlist-renderer').remove();
});
};
setInterval(function(){
channelList.forEach(function(channel) {
removeResultsForChannel(channel);
}, 500);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment