YouTube 防止自動配音

強制所有 YouTube 影片以原始語言音訊播放,而不是 AI 配音的語言。適用於一般影片和 Shorts。可針對單一影片手動關閉。

目前為 2025-08-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                           YouTube Prevent Auto-Dub
// @name:zh-TW                     YouTube 防止自動配音
// @name:zh-CN                     YouTube 防止自动配音
// @name:ja                        YouTube 自動吹き替え防止
// @icon                           https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @author                         ElectroKnight22
// @namespace                      electroknight22_prevent_auto_dub_namespace
// @version                        0.0.1
// @match                          *://www.youtube.com/*
// @exclude                        *://www.youtube.com/live_chat*
// @run-at                         document-start
// @license                        MIT
// @description                    Forces all YouTube videos to play in their original language audio instead of the AI dubbed language. Works in both normal videos and shorts. Can be manually overridden per-video.
// @description:zh-TW              強制所有 YouTube 影片以原始語言音訊播放,而不是 AI 配音的語言。適用於一般影片和 Shorts。可針對單一影片手動關閉。
// @description:zh-CN              强制所有 YouTube 视频以原始语言音频播放,而不是 AI 配音的语言。适用于一般视频和 Shorts。可针对单个视频手动关闭。
// @description:ja                 すべてのYouTube動画をAI吹き替えではなく、元の言語の音声で強制的に再生します。通常の動画とショート動画の両方で機能します。動画ごとに手動で無効にすることもできます。
// ==/UserScript==

(function () {
    'use strict';

    function main(event) {
        try {
            const player = event.target.player_;
            if (player.getAvailableAudioTracks().length === 0) return;
            const playerResponse = player.getPlayerResponse();
            const originalAudioIndex = playerResponse.captions.playerCaptionsTracklistRenderer.defaultAudioTrackIndex;
            const originalAudioId = playerResponse.captions.playerCaptionsTracklistRenderer.audioTracks[originalAudioIndex].audioTrackId;
            const currentAudioTrack = player.getAudioTrack();
            if (currentAudioTrack.Vp.id === originalAudioId) return;
            const availableAudioTracks = player.getAvailableAudioTracks();
            const originalAudioTrack = availableAudioTracks.find((audioTrack) => audioTrack.Vp.id === originalAudioId);
            player.setAudioTrack(originalAudioTrack);
        } catch (error) {
            console.error('Failed to prevent YouTube auto-dubbing.', error);
        }
    }

    window.addEventListener('yt-player-updated', main, true);
})();