Hide videos not belonging to the channel when searching in it.
目前為
// ==UserScript==
// @name YT Channel Query Fix
// @namespace youtube.scripts
// @version 1.7
// @description Hide videos not belonging to the channel when searching in it.
// @include *.youtube.com/user/*search*
// @include *.youtube.com/c*/*search*
// ==/UserScript==
(function() {
'use strict';
const INTERVAL = 1000;
const this_channel = document.querySelector('#form[action]').action.replace(/.?search$/, '');
var last_count = 0;
setInterval(() => {
let nodes = document.querySelectorAll("ytd-item-section-renderer");
if(nodes.length === last_count) { return; }
last_count = nodes.length;
for(let e of nodes) {
let a = e.querySelector("#metadata a");
if(!e.hidden && a.href != this_channel) {
e.hidden = true;
}
}
}, INTERVAL);
})();