Youtube Hide Recomended (English)

Automatically switches YouTube's recommendation column to either "From the series", "from (channel name)", or "Related"

当前为 2025-05-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube Hide Recomended (English)
  3. // @name:ja YouTubeのリコメンド自動切換・非表示(英語環境用)
  4. // @version 2025-05-19
  5. // @description Automatically switches YouTube's recommendation column to either "From the series", "from (channel name)", or "Related"
  6. // @description:ja YouTubeのリコメンド欄を自動でFrom the series、from (チャンネル名)、Relatedのどれかに切り替えます
  7. // @author hirhirbyrd
  8. // @match https://www.youtube.com/*
  9. // @license MIT
  10. // @namespace https://greasyfork.org/users/1467931
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. const observer = new MutationObserver(() => {
  15. const chname = document.querySelector('.complex-string.ytd-channel-name.style-scope')
  16. const lists = document.querySelector('div#secondary-inner.style-scope.ytd-watch-flexy');
  17. const elementC = document.querySelector('div#related iron-selector#chips yt-chip-cloud-chip-renderer:has(#text[title="From the series"])');
  18. const elementA = document.querySelector('div#related iron-selector#chips yt-chip-cloud-chip-renderer:has(#text[title="From ' + chname.textContent + '"])');
  19. const elementB = document.querySelector('div#related iron-selector#chips yt-chip-cloud-chip-renderer:has(#text[title="Related"])');
  20. if (elementC) {
  21. if (elementC.getAttribute('aria-selected') === 'false') {
  22. lists.hidden = false;
  23. elementC.click();
  24. }
  25. } else if (elementA) {
  26. if (elementA.getAttribute('aria-selected') === 'false') {
  27. lists.hidden = false;
  28. elementA.click();
  29. }
  30. } else if (elementB) {
  31. if (elementB.getAttribute('aria-selected') === 'false') {
  32. lists.hidden = false;
  33. elementB.click();
  34. }
  35. } else {
  36. lists.hidden = true;
  37. return;
  38. }
  39. });
  40. observer.observe(document, { childList: true, subtree: true });
  41. })();