YouTube Original Audio Selector

Automatically sets YouTube videos to their original audio language

< 腳本YouTube Original Audio Selector的回應

評論:負評 - 腳本失效或無法使用

§
發表於:2024-12-18

Sadly the fist step of this script is broken. hasMultipleAudioTracks seam to only check for the Audio tracks for some languages were automatically generated sentence, but this is nowhere to be found.

When i force this to return true no mater the result, then everything else does work without an itch. so it's only the very first part that look broken on video with alternative but no "auto-generated" audio

    // Function to check if video has multiple audio tracks
    function hasMultipleAudioTracks() {
        const autoGeneratedText = document.evaluate(
            "//*[contains(text(),'Audio tracks for some languages were automatically generated')]",
            document,
            null,
            XPathResult.FIRST_ORDERED_NODE_TYPE,
            null
        ).singleNodeValue;

        return true; //!!autoGeneratedText;
    }
§
發表於:2024-12-18
編輯:2024-12-18

I found that i had a Dubbed label under the video title to look for so i added it to the list

    // Function to check if video has multiple audio tracks
    function hasMultipleAudioTracks() {
        let sentences = [
            'Dubbed',
            'Audio tracks for some languages were automatically generated'
        ];
        let xpathQuery = sentences.map(sentence => `//*[contains(text(),'${sentence}')]`).join(' | ');

        const autoGeneratedText = document.evaluate(
            xpathQuery,
            document,
            null,
            XPathResult.FIRST_ORDERED_NODE_TYPE,
            null
        ).singleNodeValue;

        return !!autoGeneratedText;
    }

發表回覆

登入以回覆

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址