YouTube Auto HD

Tự động đặt chất lượng video YouTube lên 1080p hoặc 720p

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         YouTube Auto HD
// @namespace    https://tampermonkey.net/
// @version      1.1
// @description  Tự động đặt chất lượng video YouTube lên 1080p hoặc 720p
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function setQuality() {
        const player = document.querySelector('video');
        const ytPlayer = document.getElementById('movie_player');

        if (!ytPlayer || !ytPlayer.getAvailableQualityLevels) return;

        const levels = ytPlayer.getAvailableQualityLevels();

        if (levels.includes('hd1080')) {
            ytPlayer.setPlaybackQualityRange('hd1080');
        } else if (levels.includes('hd720')) {
            ytPlayer.setPlaybackQualityRange('hd720');
        } else if (levels.length > 0) {
            ytPlayer.setPlaybackQualityRange(levels[0]);
        }
    }

    // Đợi video load
    setInterval(setQuality, 2000);
})();