Rumble - Auto Force Lowest Quality (Adaptive Final)

FINAL ADAPTIVE SOLUTION: Uses the proven interval logic and loops through quality options to skip 'Auto' and guarantee lowest resolution selection.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Rumble - Auto Force Lowest Quality (Adaptive Final)
// @namespace    rumble-automation
// @version      14.0
// @description  FINAL ADAPTIVE SOLUTION: Uses the proven interval logic and loops through quality options to skip 'Auto' and guarantee lowest resolution selection.
// @author       Gemini
// @license      MIT
// @match        *://rumble.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let $url = "";
    let $click_times = 0;

    const simpleClick = (target, a) => {
        if(target){
            target.click();
        }
        if(a){
            $click_times++;
        }
    };

    const rumbleQualityInterval = setInterval(() => {
        let currentUrl = document.URL;

        if(currentUrl !== $url || $click_times < 3){
            try{
                // *** 1. PROVEN TRAVERSAL (Gear Icon/Menu Container) ***
                let playback = document.getElementsByClassName("touched_overlay_item")[0].nextElementSibling.lastChild.lastChild;

                // Get the Gear Icon
                let gearIcon = playback.firstChild;

                // *** 2. CLICK GEAR ICON ***
                simpleClick(gearIcon);

                // *** 3. CLICK LOWEST RESOLUTION (Adaptive) ***

                // Get the Resolution List container (UL element)
                let resolutionList = playback.lastChild.lastChild;

                // Loop through all *element* children (LI tags) to find the lowest quality option
                let lowestQualityOption = null;

                // Use .children to get only element nodes (<li>) and ignore text nodes
                for (let i = 0; i < resolutionList.children.length; i++) {
                    let option = resolutionList.children[i];
                    let text = option.textContent.trim().toLowerCase();

                    // Skip the 'Auto' option. The first option that is NOT 'Auto' is the lowest resolution stream.
                    if (text.includes("auto")) {
                        continue;
                    }

                    // This is the desired lowest resolution stream
                    lowestQualityOption = option;
                    break;
                }

                if (lowestQualityOption) {
                    simpleClick(lowestQualityOption, true);
                    console.log(`Rumble Auto Quality: SUCCESSFULLY FORCED to lowest available (${lowestQualityOption.textContent.trim()}).`);
                }

            } catch(e) {
                // Failure is expected when the menu is not yet loaded/rendered
            }

            // *** 4. LOOP BREAK CONDITION ***
            if($click_times >= 3){
                $click_times = 0;
                $url = currentUrl;
                clearInterval(rumbleQualityInterval);
            }
        }
    }, 500);
})();