您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes YouTube Shorts Videos from your current page and sets video to the highest quality, including 4K and beyond.
当前为
// ==UserScript== // @name Remove YouTube Shorts + Best Video Quality // @version 0.1 // @description Removes YouTube Shorts Videos from your current page and sets video to the highest quality, including 4K and beyond. // @author Science // @match http://*.youtube.com/* // @namespace https://gf.qytechs.cn/it/users/79810-sciencefun // @match https://*.youtube.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com // @grant none // @license GPL version 3 or any later version http://www.gnu.org/copyleft/gpl.html // ==/UserScript== (() => { // Function to remove YouTube Shorts const removeShorts = () => { Array.from(document.querySelectorAll(`a[href^="/shorts"]`)).forEach(a => { let parent = a.closest('ytd-rich-item-renderer'); // Find the closest container if (parent) { parent.remove(); } }); }; // Function to set the video quality to the highest available (4K or above) const setHighQuality = () => { const checkPlayer = setInterval(() => { const player = document.querySelector('video'); // Get the video element if (player) { clearInterval(checkPlayer); // Stop checking once player is found // Ensure YouTube player API is ready const ytPlayer = window.ytplayer?.player?.getPlayer(); if (ytPlayer && ytPlayer.getAvailableQualityLevels) { const availableQualities = ytPlayer.getAvailableQualityLevels(); // Get available quality levels if (availableQualities && availableQualities.length > 0) { // Ensure it selects the highest resolution (4K or more) const maxQuality = availableQualities.find(q => q === 'highres') || availableQualities[0]; ytPlayer.setPlaybackQualityRange(maxQuality); // Set to the highest resolution } } } }, 500); // Check every 500ms for the player }; // Set up MutationObserver to monitor for changes and apply modifications const observer = new MutationObserver(() => { removeShorts(); setHighQuality(); }); observer.observe(document, { childList: true, subtree: true, }); // Initial run removeShorts(); setHighQuality(); // Re-apply high quality on video play (in case it changes dynamically) document.addEventListener('yt-navigate-finish', setHighQuality); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址