Greasy Fork 还支持 简体中文。

Hide RR or Not Live Streams on Twitch ASMR

Hides streams containing "RR", "!RR", "(no live)", "Not live", "RERUN", "ReRun", or similar variants in the full title on Twitch's ASMR page.

  1. // ==UserScript==
  2. // @name Hide RR or Not Live Streams on Twitch ASMR
  3. // @match *://www.twitch.tv/directory/category/asmr
  4. // @grant none
  5. // @version 1.0
  6. // @author Nanu
  7. // @description Hides streams containing "RR", "!RR", "(no live)", "Not live", "RERUN", "ReRun", or similar variants in the full title on Twitch's ASMR page.
  8. // @license MIT
  9. // @namespace https://greasyfork.org/users/1444078
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Enhanced regex to detect "RR", "!RR", "(no live)", "Not live", "RERUN", "ReRun", etc.
  16. const reRunPattern = /(\b|!|\W)(rr|rerun|re-run|повтор)\b|\(no live\)|not live|💗\s*rerun|💕\s*rerun|❤️‍🔥\s*rerun/i;
  17.  
  18. // Function to hide streams matching the pattern
  19. function hideReRunStreams() {
  20. // Select all stream title elements
  21. document.querySelectorAll('h3.CoreText-sc-1txzju1-0').forEach(titleElement => {
  22. // Get the full title from the `title` attribute or visible text
  23. const fullTitle = titleElement.getAttribute('title') || titleElement.textContent;
  24.  
  25. // Check if the full title matches the pattern
  26. if (reRunPattern.test(fullTitle)) {
  27. // Hide the stream (the stream container is the closest <article> with the specific class)
  28. const streamCard = titleElement.closest('article.Layout-sc-1xcs6mc-0.jivRFd');
  29. if (streamCard) {
  30. // Find the main container wrapping the <article>
  31. const parentContainer = streamCard.closest('div[data-target]');
  32. if (parentContainer) {
  33. parentContainer.style.display = 'none'; // Hide the main container
  34. }
  35. }
  36. }
  37. });
  38. }
  39.  
  40. // Run the function initially
  41. hideReRunStreams();
  42.  
  43. // Observe page changes to apply the filter dynamically
  44. const observer = new MutationObserver(hideReRunStreams);
  45. observer.observe(document.body, { childList: true, subtree: true });
  46. })();