Hide feeds

Hide youtube and bilibili home page recommendations 90% (so you still have chance to know what's trending) of the time. Preventing the algorithm steal you time.

  1. // ==UserScript==
  2. // @name Hide feeds
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Hide youtube and bilibili home page recommendations 90% (so you still have chance to know what's trending) of the time. Preventing the algorithm steal you time.
  6. // @author zplay
  7. // @match https://*.youtube.com/
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
  9. // @require https://gf.qytechs.cn/scripts/383527-wait-for-key-elements/code/Wait_for_key_elements.js?version=701631
  10. // @match (https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)*
  11. // @match https://www.bilibili.com/*
  12. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  13. // @grant none
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. function addGlobalStyle(css,id) {
  21. var head, style;
  22. head = document.getElementsByTagName('head')[0];
  23. if (!head) { return; }
  24. style = document.getElementById(id);
  25. if (!style){
  26. style = document.createElement('style');
  27. }
  28. style.id=id;
  29. style.type = 'text/css';
  30. style.innerHTML = css;
  31. head.appendChild(style);
  32. }
  33.  
  34.  
  35. function removeElementById(elementId) {
  36. const element = document.getElementById(elementId);
  37. if (element && element.parentNode) {
  38. element.parentNode.removeChild(element);
  39. }
  40. }
  41.  
  42.  
  43. function isYouTubeHomepage() {
  44. const youtubeHomepageRegex =/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/?$/;
  45.  
  46. return youtubeHomepageRegex.test(window.location.href);
  47. }
  48.  
  49.  
  50. function runScript() {
  51. if (isYouTubeHomepage()){
  52. const hideFeed = ` #contents { display: none !important; } `;
  53. addGlobalStyle(hideFeed,"yt-feed");
  54. }
  55. else
  56. {
  57. removeElementById("yt-feed");
  58. }
  59. }
  60.  
  61.  
  62. if(Math.random()>0.9){
  63. return;
  64. }
  65. waitForKeyElements ("div", runScript);
  66. runScript();
  67.  
  68. const hideFeed = ` #related { display: none !important; } `;
  69. addGlobalStyle(hideFeed,"yt-related");
  70.  
  71. const hideBiliFeed = ` .feed2, .rec-list { display: none !important; } `;
  72. addGlobalStyle(hideBiliFeed,"bili-feed");
  73.  
  74.  
  75. // Your code here...
  76. })();

QingJ © 2025

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