Introduce usage of potoken for GVS for visitor data users
This commit is contained in:
1 parent
5e34ce8067
commit
7e21e46ec0
4 files changed
+47
-4
No files matched your search
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Attempt to fix `MISSING_FORMAT_FIELD` error in live videos
|
- Attempt to fix `MISSING_FORMAT_FIELD` error in live videos
|
||||||
|
- Attempt to fix `No valid bitrates` error
|
||||||
|
|
||||||
## [0.47.3] - 2026-06-23
|
## [0.47.3] - 2026-06-23
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace Innertube
|
|||||||
|
|
||||||
if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken
|
if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken
|
||||||
request.Header("x-goog-visitor-id", visitorData)
|
request.Header("x-goog-visitor-id", visitorData)
|
||||||
|
request.poTokenIdentity = visitorData
|
||||||
end if
|
end if
|
||||||
|
|
||||||
request.signatureTimestamp = signatureTimestamp
|
request.signatureTimestamp = signatureTimestamp
|
||||||
@@ -102,7 +103,7 @@ namespace Innertube
|
|||||||
adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]))
|
adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"]))
|
||||||
formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"]))
|
formats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "formats"]))
|
||||||
|
|
||||||
error = DecipherUrls(formats, adaptiveFormats, playerRequest.signatureTimestamp, cancellation, client)
|
error = DecipherUrls(formats, adaptiveFormats, playerRequest.signatureTimestamp, cancellation, client, playerRequest.poTokenIdentity)
|
||||||
if error <> invalid
|
if error <> invalid
|
||||||
parsedResponse["error"] = error.error
|
parsedResponse["error"] = error.error
|
||||||
if error.DoesExist("errorCode")
|
if error.DoesExist("errorCode")
|
||||||
@@ -111,6 +112,9 @@ namespace Innertube
|
|||||||
return parsedResponse
|
return parsedResponse
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
parsedResponse["potAttached"] = HasPotParam(adaptiveFormats) or HasPotParam(formats)
|
||||||
|
LogDebug("poToken attached to deciphered urls:", parsedResponse["potAttached"])
|
||||||
|
|
||||||
' if isLive and adaptiveFormats.Count() > 0
|
' if isLive and adaptiveFormats.Count() > 0
|
||||||
' LogInfo("[LIVE-INFO] post-decipher, sts:", playerRequest.signatureTimestamp, "format[0].itag:", adaptiveFormats[0]["itag"], "url:", adaptiveFormats[0]["url"])
|
' LogInfo("[LIVE-INFO] post-decipher, sts:", playerRequest.signatureTimestamp, "format[0].itag:", adaptiveFormats[0]["itag"], "url:", adaptiveFormats[0]["url"])
|
||||||
' end if
|
' end if
|
||||||
@@ -499,7 +503,19 @@ namespace Innertube
|
|||||||
return json["sts"]
|
return json["sts"]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function DecipherUrls(formats as object, adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object, client = invalid as dynamic) as object
|
function HasPotParam(formats as object) as boolean
|
||||||
|
for each fmt in formats
|
||||||
|
url = fmt["url"]
|
||||||
|
if not StringUtils.IsNullOrEmpty(url)
|
||||||
|
if url.Instr("&pot=") <> -1
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
return false
|
||||||
|
end function
|
||||||
|
|
||||||
|
function DecipherUrls(formats as object, adaptiveFormats as object, signatureTimestamp as dynamic, cancellation as object, client = invalid as dynamic, poTokenIdentity = invalid as dynamic) as object
|
||||||
if signatureTimestamp = invalid
|
if signatureTimestamp = invalid
|
||||||
' No need to decipher if signatureTimestamp is not available
|
' No need to decipher if signatureTimestamp is not available
|
||||||
return invalid
|
return invalid
|
||||||
@@ -523,11 +539,16 @@ namespace Innertube
|
|||||||
})
|
})
|
||||||
end for
|
end for
|
||||||
|
|
||||||
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v2/decipher`, {
|
body = {
|
||||||
"sts": signatureTimestamp
|
"sts": signatureTimestamp
|
||||||
"formats": reqFormats
|
"formats": reqFormats
|
||||||
"adaptiveFormats": reqAdaptiveFormats
|
"adaptiveFormats": reqAdaptiveFormats
|
||||||
})
|
}
|
||||||
|
if not StringUtils.IsNullOrEmpty(poTokenIdentity)
|
||||||
|
body["identity"] = poTokenIdentity
|
||||||
|
end if
|
||||||
|
|
||||||
|
request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v2/decipher`, body)
|
||||||
request.Cancellation(cancellation)
|
request.Cancellation(cancellation)
|
||||||
|
|
||||||
request.LogCurlCommand(false)
|
request.LogCurlCommand(false)
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ function ExecuteJob() as void
|
|||||||
"accessToken": accessToken
|
"accessToken": accessToken
|
||||||
"onBehalfOfUser": onBehalfOfUser
|
"onBehalfOfUser": onBehalfOfUser
|
||||||
})
|
})
|
||||||
|
if IsAssociativeArray(metadata)
|
||||||
|
contentNode.addFields({
|
||||||
|
potAttached: ValidBool(metadata.potAttached)
|
||||||
|
loggedIn: not StringUtils.IsNullOrEmpty(accessToken)
|
||||||
|
})
|
||||||
|
end if
|
||||||
else
|
else
|
||||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1404,6 +1404,17 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u
|
|||||||
data: ValidString(ReadAsciiFile("cachefs:/last_player_response.json"))
|
data: ValidString(ReadAsciiFile("cachefs:/last_player_response.json"))
|
||||||
}]
|
}]
|
||||||
end if
|
end if
|
||||||
|
potAttached = "false"
|
||||||
|
loggedIn = "false"
|
||||||
|
content = m.top.content
|
||||||
|
if content <> invalid
|
||||||
|
if ValidBool(content.potAttached)
|
||||||
|
potAttached = "true"
|
||||||
|
end if
|
||||||
|
if ValidBool(content.loggedIn)
|
||||||
|
loggedIn = "true"
|
||||||
|
end if
|
||||||
|
end if
|
||||||
message = [
|
message = [
|
||||||
errorData.title
|
errorData.title
|
||||||
errorData.body
|
errorData.body
|
||||||
@@ -1413,8 +1424,12 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u
|
|||||||
`Url: ${url}`
|
`Url: ${url}`
|
||||||
"Urls: " + FormatJson(urls)
|
"Urls: " + FormatJson(urls)
|
||||||
`Url index: ${urlIndex}`
|
`Url index: ${urlIndex}`
|
||||||
|
`pot_attached: ${potAttached}`
|
||||||
|
`logged_in: ${loggedIn}`
|
||||||
].Join(Chr(10))
|
].Join(Chr(10))
|
||||||
errorData.fingerprint.Push(shownInDialog)
|
errorData.fingerprint.Push(shownInDialog)
|
||||||
|
errorData.fingerprint.Push(potAttached)
|
||||||
|
errorData.fingerprint.Push(loggedIn)
|
||||||
if shownInDialog
|
if shownInDialog
|
||||||
level = "error"
|
level = "error"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user