@@ -232,7 +232,18 @@ export async function getLocalVideoInfo(id) {
232232
233233 const info = await webInnertube . getInfo ( id , { po_token : contentPoToken } )
234234
235- // temporary workaround for SABR-only responses
235+ // #region temporary workaround for SABR-only responses
236+
237+ // MWEB doesn't have an audio track selector so it picks the audio track on the server based on the request language.
238+
239+ const originalAudioTrackFormat = info . streaming_data ?. adaptive_formats . find ( format => {
240+ return format . has_audio && format . is_original && format . language
241+ } )
242+
243+ if ( originalAudioTrackFormat ) {
244+ webInnertube . session . context . client . hl = originalAudioTrackFormat . language
245+ }
246+
236247 const mwebInfo = await webInnertube . getBasicInfo ( id , { client : 'MWEB' , po_token : contentPoToken } )
237248
238249 if ( mwebInfo . playability_status . status === 'OK' && mwebInfo . streaming_data ) {
@@ -242,6 +253,8 @@ export async function getLocalVideoInfo(id) {
242253 clientName = 'MWEB'
243254 }
244255
256+ // #endregion temporary workaround for SABR-only responses
257+
245258 let hasTrailer = info . has_trailer
246259 let trailerIsAgeRestricted = info . getTrailerInfo ( ) === null
247260
@@ -324,6 +337,10 @@ export async function getLocalVideoInfo(id) {
324337 url . searchParams . set ( 'pot' , contentPoToken )
325338 url . searchParams . set ( 'c' , clientName )
326339
340+ // Remove &xosf=1 as it adds `position:63% line:0%` to the subtitle lines
341+ // placing them in the top right corner
342+ url . searchParams . delete ( 'xosf' )
343+
327344 captionTrack . base_url = url . toString ( )
328345 }
329346 }
0 commit comments