π GreatFilter for YouTube π
Filter out low view count videos from the YouTube homepage
π A script that enhances your YouTube browsing experience by filtering out (dimming or removing) videos with low view counts - no more being happily spoonfed inclusive mediocrity masquerading as relevance π
Features:
- Automatically filters videos based on a customizable view count threshold (default 5000)
- Provides multiple options for handling filtered videos (dimming, hiding, or removing)
- Respects user choices by not affecting subscriptions feed or channel pages
Note: Congratulations YouTube on being the single website I need 5 addons and a script to be half usable even with premium βοΈπ―
Install a user script manager extension like:
-
Click on the extension icon in your browser toolbar and select "Create a new script"
-
Replace any existing code with the GreatFilter script below:
// ==UserScript==
// @name GreatFilter
// @description Remove Low view count videos from the YouTube homepage
// @version 1.0.3
// @author Tremeschin
// @match *://*.youtube.com/*
// @namespace http://tampermonkey.net/
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// ==/UserScript==
(function() {
'use strict';
// Act on videos that have less than this amount of views
const VIEW_THRESHOLD = 5000;
function isBadVideo(views) {
console.log("Checking is bad video", views.innerText);
// Match for 'N.Nuu views' (1.3K, 2.0M, 1Mrd) until the next space ('views' word)
let match = views.innerText.trim().match(/^(\d+(?:\.\d+)?)\s*([^\s]+)?/);
if (!match) return false;
// Unpack and find true values
let [, number, unit] = match;
number = parseFloat(number);
// Find the true total number of views
switch (unit.toLowerCase()) {
case 'k':
number *= 1000;
break;
case 'm':
case 'mm':
number *= 1000000;
break;
case 'b':
case 'g':
case 'mrd':
case 'md':
number *= 1000000000;
break;
}
return (number < VIEW_THRESHOLD);
}
function filterVideos() {
// Skip if intentionally seeing subscriptions or a channel page
if (location.pathname.startsWith("/feed/subscriptions")) {
return;
}
if (location.pathname.startsWith("/@")) {
return;
}
// Act on the homepage or shorts
if (location.pathname.startsWith("/shorts")) {
document.querySelectorAll('.reel-video-in-sequence.style-scope.ytd-shorts').forEach(video => {
if (video.isActive) {
const views = video.querySelector('.yt-spec-button-shape-with-label__label');
if (views && isBadVideo(views)) {
const nextButton = document.querySelector('.navigation-button.style-scope.ytd-shorts .yt-spec-touch-feedback-shape__fill');
if (nextButton) nextButton.click();
}
}
});
} else {
document.querySelectorAll('ytd-rich-item-renderer, ytd-item-section-renderer').forEach(video => {
const meta = video.querySelectorAll('.yt-content-metadata-view-model__metadata-row');
const views = meta[1]?.querySelector('span');
if (!views) return;
// Note: Select some options below:
if (isBadVideo(views)) {
// Send the video to the shadow realm
video.remove();
// More gracefully to the shadow realm
// video.style.display = 'none';
// Fair compromise, still visible but dimmed
// video.style.opacity = '0.10';
// Remove clickable links
// video.querySelectorAll('a').forEach(a => a.removeAttribute('href'));
}
});
}
}
// Run the filter function whenever the page changes
const observer = new MutationObserver(filterVideos);
observer.observe(document.body, {childList: true, subtree: true});
})();-
Optionally modify the
VIEW_THRESHOLDand comment/uncomment the desired filtering behavior at the end of thefilterVideosfunction (dim, remove, or hide videos) -
Save the script and reload any YouTube pages