api/youtube: pick a default track for videos with ai dubs

This commit is contained in:
wukko 2024-10-28 19:35:08 +06:00
parent 9f9300ebb8
commit b14c618228
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -263,6 +263,12 @@ export default async function(o) {
audio = selected.audio.find(i => i.isDefault);
// some videos (mainly those with AI dubs) don't have any tracks marked as default
// why? god knows, but we assume that a default track is marked as such in the title
if (!audio) {
audio = selected.audio.find(i => i.name.endsWith("- original"));
}
if (o.dubLang) {
const dubbedAudio = selected.audio.find(i =>
i.language === o.dubLang