@@ -242,7 +242,18 @@ export async function getLocalVideoInfo(id) {
242242
243243 const info = await webInnertube . getInfo ( id , { po_token : contentPoToken } )
244244
245- // temporary workaround for SABR-only responses
245+ // #region temporary workaround for SABR-only responses
246+
247+ // MWEB doesn't have an audio track selector so it picks the audio track on the server based on the request language.
248+
249+ const originalAudioTrackFormat = info . streaming_data ?. adaptive_formats . find ( format => {
250+ return format . has_audio && format . is_original && format . language
251+ } )
252+
253+ if ( originalAudioTrackFormat ) {
254+ webInnertube . session . context . client . hl = originalAudioTrackFormat . language
255+ }
256+
246257 const mwebInfo = await webInnertube . getBasicInfo ( id , { client : 'MWEB' , po_token : contentPoToken } )
247258
248259 if ( mwebInfo . playability_status . status === 'OK' && mwebInfo . streaming_data ) {
@@ -252,6 +263,8 @@ export async function getLocalVideoInfo(id) {
252263 clientName = 'MWEB'
253264 }
254265
266+ // #endregion temporary workaround for SABR-only responses
267+
255268 let hasTrailer = info . has_trailer
256269 let trailerIsAgeRestricted = info . getTrailerInfo ( ) === null
257270
@@ -339,6 +352,10 @@ export async function getLocalVideoInfo(id) {
339352 url . searchParams . set ( 'pot' , contentPoToken )
340353 url . searchParams . set ( 'c' , clientName )
341354
355+ // Remove &xosf=1 as it adds `position:63% line:0%` to the subtitle lines
356+ // placing them in the top right corner
357+ url . searchParams . delete ( 'xosf' )
358+
342359 captionTrack . base_url = url . toString ( )
343360 }
344361 }
0 commit comments