Automatically sets YouTube videos to their original audio language
< Feedback on YouTube Original Audio Selector
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;
}
Sadly the fist step of this script is broken.
hasMultipleAudioTracks
seam to only check for theAudio 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