YouTube Original Audio Selector

Automatically sets YouTube videos to their original audio language

< Feedback on YouTube Original Audio Selector

Review: खराब - स्क्रिप्ट चालत नाही

§
पोस्ट केले: 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;
    }

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.