Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name remove popular videos
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.youtube.com/
// @grant none
// ==/UserScript==
(function() {
'use strict';
function getViews(item) {
let bylines = item.getElementsByClassName('ytm-badge-and-byline-item-byline');
for (var i=0; i < bylines.length; i++) {
let txt = bylines[i].innerHTML;
if (txt && txt.indexOf('views') > -1) return txt;
}
}
function update() {
let items = document.getElementsByTagName('ytm-rich-item-renderer');
for (var i=0; i < items.length; i++) {
let item = items[i];
let views = getViews(item);
if (views && views.indexOf('M') > -1) {
item.parentNode.removeChild(item);
}
}
}
update();
setInterval(update, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment