@@ -199,7 +199,7 @@ export async function getLocalSearchContinuation(continuationData) {
199199export async function getLocalVideoInfo ( id ) {
200200 const webInnertube = await createInnertube ( { withPlayer : true , generateSessionLocally : false } )
201201
202- // based on the videoId (added to the body of the /player request)
202+ // based on the videoId (added to the body of the /player request and to caption URLs )
203203 let contentPoToken
204204 // based on the visitor data (added to the streaming URLs)
205205 let sessionPoToken
@@ -223,6 +223,8 @@ export async function getLocalVideoInfo(id) {
223223 }
224224 }
225225
226+ let clientName = webInnertube . session . context . client . clientName
227+
226228 const info = await webInnertube . getInfo ( id )
227229
228230 // temporary workaround for SABR-only responses
@@ -231,6 +233,8 @@ export async function getLocalVideoInfo(id) {
231233 if ( mwebInfo . playability_status . status === 'OK' && mwebInfo . streaming_data ) {
232234 info . playability_status = mwebInfo . playability_status
233235 info . streaming_data = mwebInfo . streaming_data
236+
237+ clientName = 'MWEB'
234238 }
235239
236240 let hasTrailer = info . has_trailer
@@ -265,6 +269,8 @@ export async function getLocalVideoInfo(id) {
265269
266270 hasTrailer = false
267271 trailerIsAgeRestricted = false
272+
273+ clientName = webEmbeddedInnertube . session . context . client . clientName
268274 }
269275 }
270276
@@ -309,6 +315,18 @@ export async function getLocalVideoInfo(id) {
309315 }
310316 }
311317
318+ if ( info . captions ?. caption_tracks ) {
319+ for ( const captionTrack of info . captions . caption_tracks ) {
320+ const url = new URL ( captionTrack . base_url )
321+
322+ url . searchParams . set ( 'potc' , '1' )
323+ url . searchParams . set ( 'pot' , contentPoToken )
324+ url . searchParams . set ( 'c' , clientName )
325+
326+ captionTrack . base_url = url . toString ( )
327+ }
328+ }
329+
312330 return info
313331}
314332
0 commit comments