YT Channel Query Fix

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

2020/11/28のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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);
})();