api/youtube: don't use session if user wants subtitles

cuz they're not currently available anywhere but HLS
This commit is contained in:
wukko 2025-06-20 17:27:49 +06:00
parent 993a885a3e
commit 7ce9d6882b
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -175,14 +175,13 @@ export default async function (o) {
useHLS = false; useHLS = false;
} }
// we can get subtitles reliably only from the iOS client if (useHLS) {
if (useHLS || o.subtitleLang) {
innertubeClient = "IOS"; innertubeClient = "IOS";
} }
// iOS client doesn't have adaptive formats of resolution >1080p, // iOS client doesn't have adaptive formats of resolution >1080p,
// so we use the WEB_EMBEDDED client instead for those cases // so we use the WEB_EMBEDDED client instead for those cases
const useSession = let useSession =
env.ytSessionServer && ( env.ytSessionServer && (
( (
!useHLS !useHLS
@ -194,6 +193,12 @@ export default async function (o) {
) )
); );
// we can get subtitles reliably only from the iOS client
if (o.subtitleLang) {
innertubeClient = "IOS";
useSession = false;
}
if (useSession) { if (useSession) {
innertubeClient = env.ytSessionInnertubeClient || "WEB_EMBEDDED"; innertubeClient = env.ytSessionInnertubeClient || "WEB_EMBEDDED";
} }