Use datasyncIdToken as poTokenIdentity

This commit is contained in:
Brahim Hadriche committed 2026-06-25 15:47:26 -04:00
1 parent 6a4a61b61f
commit 5e798f19de
12 files changed
+132

No files matched your search

@@ -28,6 +28,13 @@ namespace InnertubeService
accessToken = OptionUtils.Get(options, "accessToken")
raw = OptionUtils.GetOrDefault(options, "raw", false)
if not StringUtils.IsNullOrEmpty(accessToken)
profileNode = OptionUtils.Get(options, "profileNode")
if profileNode <> invalid
options["datasyncIdToken"] = GetProfileDatasyncIdToken(profileNode, accessToken, OptionUtils.Get(options, "profilesService"), cancellation)
end if
end if
nextRequest = invalid
if fetchNext
nextRequest = Innertube.CreateNextRequest({ "videoId": videoId }, options)
@@ -760,6 +767,39 @@ namespace InnertubeService
return Innertube.ListAccounts(accessToken, cancellation)
end function
function GetProfileDatasyncIdToken(profileNode as object, accessToken as string, profilesService as object, cancellation as object) as string
endpoint = profileNode.selectActiveIdentityEndpoint
if not IsAssociativeArray(endpoint) or endpoint.Count() = 0
endpoint = BackfillSelectActiveIdentityEndpoint(profileNode, accessToken, profilesService, cancellation)
end if
return Innertube.GetDatasyncIdToken(endpoint)
end function
function BackfillSelectActiveIdentityEndpoint(profileNode as object, accessToken as string, profilesService as object, cancellation as object) as object
LogInfo("Backfilling selectActiveIdentityEndpoint for signed-in profile")
accounts = Innertube.ListAccounts(accessToken, cancellation)
if not IsArray(accounts)
return invalid
end if
for each account in accounts
if account.activeIdentifyToken <> profileNode.activeIdentifyToken
continue for
end if
endpoint = account.selectActiveIdentityEndpoint
if IsAssociativeArray(endpoint) and endpoint.Count() > 0
profileNode.selectActiveIdentityEndpoint = endpoint
if profilesService <> invalid
profilesService@.SaveUserProfilesToRegistry()
end if
return endpoint
end if
exit for
end for
return invalid
end function
function GetDrmLicense(options as object) as dynamic
request = Innertube.CreateGetDrmLicenceRequest(options)