diff --git a/CHANGELOG.md b/CHANGELOG.md index 319f6644..8edcdb69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Attempt to fix `MISSING_FORMAT_FIELD` error in live videos +- Attempt to fix `No valid bitrates` error ## [0.47.3] - 2026-06-23 diff --git a/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs b/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs index a1cfa937..07ab90e4 100644 --- a/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs +++ b/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs @@ -61,6 +61,7 @@ namespace Innertube if not StringUtils.IsNullOrEmpty(visitorData) and not useAccessToken request.Header("x-goog-visitor-id", visitorData) + request.poTokenIdentity = visitorData end if request.signatureTimestamp = signatureTimestamp @@ -102,7 +103,7 @@ namespace Innertube adaptiveFormats = ValidArray(ObjectUtils.Dig(payload, ["streamingData", "adaptiveFormats"])) 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 parsedResponse["error"] = error.error if error.DoesExist("errorCode") @@ -111,6 +112,9 @@ namespace Innertube return parsedResponse end if + parsedResponse["potAttached"] = HasPotParam(adaptiveFormats) or HasPotParam(formats) + LogDebug("poToken attached to deciphered urls:", parsedResponse["potAttached"]) + ' if isLive and adaptiveFormats.Count() > 0 ' LogInfo("[LIVE-INFO] post-decipher, sts:", playerRequest.signatureTimestamp, "format[0].itag:", adaptiveFormats[0]["itag"], "url:", adaptiveFormats[0]["url"]) ' end if @@ -499,7 +503,19 @@ namespace Innertube return json["sts"] 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 ' No need to decipher if signatureTimestamp is not available return invalid @@ -523,11 +539,16 @@ namespace Innertube }) end for - request = HttpClient.PostJson(`${PLAYLET_SUPPORT_SERVER}/v2/decipher`, { + body = { "sts": signatureTimestamp "formats": reqFormats "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.LogCurlCommand(false) diff --git a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs index f3cca44d..3207c5c6 100644 --- a/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs +++ b/playlet-lib/src/components/VideoPlayer/VideoContentJob.bs @@ -60,6 +60,12 @@ function ExecuteJob() as void "accessToken": accessToken "onBehalfOfUser": onBehalfOfUser }) + if IsAssociativeArray(metadata) + contentNode.addFields({ + potAttached: ValidBool(metadata.potAttached) + loggedIn: not StringUtils.IsNullOrEmpty(accessToken) + }) + end if else metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation }) end if diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs index bf112db7..1ca91bcb 100644 --- a/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs +++ b/playlet-lib/src/components/VideoPlayerDev/VideoPlayerDev.bs @@ -1404,6 +1404,17 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u data: ValidString(ReadAsciiFile("cachefs:/last_player_response.json")) }] 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 = [ errorData.title errorData.body @@ -1413,8 +1424,12 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u `Url: ${url}` "Urls: " + FormatJson(urls) `Url index: ${urlIndex}` + `pot_attached: ${potAttached}` + `logged_in: ${loggedIn}` ].Join(Chr(10)) errorData.fingerprint.Push(shownInDialog) + errorData.fingerprint.Push(potAttached) + errorData.fingerprint.Push(loggedIn) if shownInDialog level = "error" else