YT Channel Query Fix

Hide videos not belonging to the channel when searching in it.

目前为 2020-12-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         YT Channel Query Fix
// @namespace    youtube.scripts
// @version      1.8
// @description  Hide videos not belonging to the channel when searching in it.
// @include      *.youtube.com/*/search*
// ==/UserScript==

(function() {
    'use strict';

    const INTERVAL=1000;
    const channel=document.querySelector('.ytd-channel-name').innerText;

    var last_count=0;
    setInterval(function(){
        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.innerText!==channel) {
                e.hidden=true;
            }
        }
    },INTERVAL);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址