// ==UserScript== // @name Kick.com - Auto select best quality // @namespace https://greasyfork.org/en/users/1200587-trilla-g // @version 2.0 // @author Trilla_G // @description Auto select best quality // @match *://kick.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=kick.com // @grant GM_addStyle // @run-at document-start // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to check if a quality option is selected and click it if not let checkQuality = (quality) => { // Select all divs with the given class let buttons = document.querySelectorAll("div[class*='betterhover\\:hover:text-primary'].relative.flex.h-\\[30px\\].cursor-pointer.select-none.items-center.rounded-\\[3px\\].px-\\[15px\\].pl-\\[20px\\].text-sm.font-medium.leading-none.text-white.outline-none"); for (let button of buttons) { if (button.textContent.includes(quality)) { console.log(`Quality option ${quality} found`); if (button.getAttribute('aria-checked') === 'true' && button.getAttribute('data-state') === 'checked') { console.log(`Quality option ${quality} is already selected`); return true; } // Modify attributes to simulate selection button.setAttribute('aria-checked', 'true'); button.setAttribute('data-state', 'checked'); button.click(); // Simulate the click if necessary console.log(`Clicked quality option ${quality}`); return true; } } console.log(`Quality option ${quality} not found`); return false; }; // Function to set the stream quality let setStreamQuality = () => { if (checkQuality('1080p60') || checkQuality('1080p') || checkQuality('936p60') || checkQuality('720p60') || checkQuality('720p') || checkQuality('Auto') ) { return true; } return false; }; // Run the setStreamQuality function every 500 ms setInterval(() => { setStreamQuality(); }, 500); })();