File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -238,17 +238,25 @@ const executeChatAction = async (
238238 const time = Math . floor ( Date . now ( ) / 1000 ) ;
239239 const sapisid = getCookie ( '__Secure-3PAPISID' ) || getCookie ( 'SAPISID' ) ;
240240 const auth = sapisid ? `SAPISIDHASH ${ time } _${ sha1 ( `${ time } ${ sapisid } ${ currentDomain } ` ) } ` : null ;
241+ const authuser = ( ytcfg as any ) ?. data_ ?. SESSION_INDEX ;
242+ const visitorId = ( ytcfg as any ) ?. data_ ?. VISITOR_DATA ?? baseContext ?. client ?. visitorData ;
243+ const clientName = ( ytcfg as any ) ?. data_ ?. INNERTUBE_CLIENT_NAME ;
244+ const clientVersion = ( ytcfg as any ) ?. data_ ?. INNERTUBE_CLIENT_VERSION ;
241245 const heads = {
242246 headers : {
243247 'Content-Type' : 'application/json' ,
244248 Accept : '*/*' ,
249+ ...( authuser != null ? { 'X-Goog-AuthUser' : String ( authuser ) } : { } ) ,
250+ ...( visitorId != null ? { 'X-Goog-Visitor-Id' : String ( visitorId ) } : { } ) ,
251+ ...( clientName != null ? { 'X-Youtube-Client-Name' : String ( clientName ) } : { } ) ,
252+ ...( clientVersion != null ? { 'X-Youtube-Client-Version' : String ( clientVersion ) } : { } ) ,
253+ 'X-Origin' : currentDomain ,
245254 ...( auth != null ? { Authorization : auth } : { } )
246255 } ,
247256 method : 'POST' as const ,
248257 mode : 'same-origin' as const
249258 } ;
250259 const contextMenuContext = JSON . parse ( JSON . stringify ( baseContext ) ) ;
251- delete contextMenuContext . clickTracking ;
252260 const res = await fetcher ( contextMenuUrl , {
253261 ...heads ,
254262 body : JSON . stringify ( { context : contextMenuContext } )
You can’t perform that action at this time.
0 commit comments