Advertisement
Froschi

Auto-Play and Auto-Skip Crunchyroll

Jun 12th, 2025 (edited)
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Auto-Crunchy
  3. // @description  Automatically clicks play/skip when it appears
  4. // @version      1.0
  5. // @author       Froschi
  6. // @match        *://*/*
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. (function () {
  11.     'use strict';
  12.    
  13.     // Change texts to your language
  14.     const TARGET_TEXTS = [
  15.         "SKIP OPENING",
  16.         "OPENING ÜBERSPRINGEN",
  17.         "SKIP INTRO",
  18.         "ÜBERSPRINGEN",
  19.         "CREDITS ÜBERSPRINGEN"
  20.     ];
  21.  
  22.     let isCooldown = false;
  23.  
  24.     function getOwnText(el) {
  25.         return Array.from(el.childNodes)
  26.             .filter(node => node.nodeType === Node.TEXT_NODE)
  27.             .map(node => node.textContent.trim())
  28.             .join(" ");
  29.     }
  30.  
  31.     function tryClickSkipText() {
  32.         const allElements = document.querySelectorAll("*");
  33.         for (const el of allElements) {
  34.             const ownText = getOwnText(el);
  35.             if (!TARGET_TEXTS.includes(ownText)) continue;
  36.             const parent = el.parentElement;
  37.             if (!parent) continue;
  38.             console.log(`💫 Found "${ownText}" button, clicking!`);
  39.             parent.click();
  40.             return true;
  41.         }
  42.         return false;
  43.     }
  44.  
  45.     function tryClickPlayButton() {
  46.         const playButton = document.querySelector('[data-testid="vilos-large_play_pause_button"][data-test-state="paused"]');
  47.         if (!playButton) return false;
  48.         console.log("▶️ Found paused play button, clicking!");
  49.         playButton.click();
  50.         return true;
  51.     }
  52.  
  53.     const observer = new MutationObserver(() => {
  54.         if (isCooldown) return;
  55.         if (!tryClickSkipText() && !tryClickPlayButton()) return;
  56.         isCooldown = true;
  57.         console.log("🕒 Cooldown started (10s)~");
  58.         setTimeout(() => {
  59.             isCooldown = false;
  60.             console.log("✅ Cooldown over, watching again~");
  61.         }, 10000);
  62.     });
  63.  
  64.     observer.observe(document.body, {
  65.         childList: true,
  66.         subtree: true
  67.     });
  68.  
  69.     console.log("Watching for skip and play buttons.");
  70. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement