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或关注我们的公众号极客氢云获取最新地址