YT Channel Query Fix

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

当前为 2020-11-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YT Channel Query Fix
  3. // @namespace youtube.scripts
  4. // @version 1.7
  5. // @description Hide videos not belonging to the channel when searching in it.
  6. // @include *.youtube.com/user/*search*
  7. // @include *.youtube.com/c*/*search*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. const INTERVAL = 1000;
  14. const this_channel = document.querySelector('#form[action]').action.replace(/.?search$/, '');
  15. var last_count = 0;
  16. setInterval(() => {
  17. let nodes = document.querySelectorAll("ytd-item-section-renderer");
  18. if(nodes.length === last_count) { return; }
  19. last_count = nodes.length;
  20. for(let e of nodes) {
  21. let a = e.querySelector("#metadata a");
  22. if(!e.hidden && a.href != this_channel) {
  23. e.hidden = true;
  24. }
  25. }
  26. }, INTERVAL);
  27. })();

QingJ © 2025

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