您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto select best quality
当前为
- // ==UserScript==
- // @name Kick.com - Auto select best quality
- // @namespace https://greasyfork.org/en/users/1200587-trilla-g
- // @version 3.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
- // ==/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)) {
- if (button.getAttribute('aria-checked') === 'true' && button.getAttribute('data-state') === 'checked') {
- return true; // Already selected, stop further checks
- }
- // Modify attributes to simulate selection
- button.setAttribute('aria-checked', 'true');
- button.setAttribute('data-state', 'checked');
- button.click(); // Simulate the click to select the quality
- return true;
- }
- }
- return false;
- };
- // Function to set the stream quality
- let setStreamQuality = () => {
- // Try to select the best available quality and stop the interval if successful
- if (checkQuality('1080p60') ||
- checkQuality('1080p') ||
- checkQuality('936p60') ||
- checkQuality('720p60') ||
- checkQuality('720p') ||
- checkQuality('Auto')) {
- clearInterval(qualityCheckInterval); // Stop checking once the quality is set
- return true;
- }
- return false;
- };
- // Run the setStreamQuality function every 500 ms until the quality is set
- let qualityCheckInterval = setInterval(() => {
- setStreamQuality();
- }, 500);
- })();