Compare commits

..
6 Commits
21 changed files with 172 additions and 87 deletions

No files matched your search

+7
View File
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.47.4] - 2026-06-25
### Fixed
- Attempt to fix `MISSING_FORMAT_FIELD` error in live videos
- Attempt to fix `No valid bitrates` error
## [0.47.3] - 2026-06-23
### Fixed
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet",
"version": "0.47.3",
"version": "0.47.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.47.3",
"version": "0.47.4",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.44",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.47.3",
"version": "0.47.4",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.44",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.47.3",
"version": "0.47.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.47.3"
"version": "0.47.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.47.3",
"version": "0.47.4",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-app",
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=47
build_version=00003
build_version=00004
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.47.3",
"version": "0.47.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.47.3"
"version": "0.47.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.47.3",
"version": "0.47.4",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
@@ -4,6 +4,7 @@ import "pkg:/components/Services/Innertube/Constants.bs"
import "pkg:/source/utils/StringUtils.bs"
function Init()
m.top.observeField("requestVisitorData", FuncName(OnRequestVisitorData))
end function
function OnNodeReady()
@@ -11,14 +12,14 @@ function OnNodeReady()
end function
function OnRequestVisitorData() as void
if m.innertubeSessionDataJob <> invalid
if m.innertubeSessionDataJob <> invalid and not m.innertubeSessionDataJob.done
return
end if
OnForceRequestVisitorData()
RequestVisitorData()
end function
function OnForceRequestVisitorData() as void
function RequestVisitorData() as void
if m.innertubeSessionDataJob <> invalid
m.innertubeSessionDataJob.cancel = true
m.innertubeSessionDataJob = invalid
@@ -40,4 +41,8 @@ end function
function OnInnertubeSessionDataJobDone(event as object) as void
JobSystem.UnobserveCallback(event.getRoSGNode())
m.innertubeSessionDataJob = invalid
if StringUtils.IsNullOrEmpty(m.top.visitorData)
' Trigger observers in case the job threw an error and didn't set the visitorData
m.top.visitorData = ""
end if
end function
@@ -1,9 +1,8 @@
<component name="Innertube" extends="Node" includes="AutoBind">
<interface>
<field id="timestamp" type="int" />
<field id="visitorData" type="string" />
<field id="requestVisitorData" type="boolean" alwaysNotify="true" onChange="OnRequestVisitorData" />
<field id="forceRequestVisitorData" type="boolean" alwaysNotify="true" onChange="OnForceRequestVisitorData" />
<field id="visitorData" type="string" alwaysNotify="true" />
<field id="requestVisitorData" type="boolean" alwaysNotify="true" />
<field id="jobQueue" type="node" />
</interface>
</component>
@@ -15,7 +15,7 @@ import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/OptionUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
' DEBUG-only: force the downgrade retry on every non-live VOD.
' DEBUG-only: force the SABR downgrade retry on every playable response.
#const DEBUG_FORCE_SABR_DOWNGRADE = false
namespace InnertubeService
@@ -84,6 +84,7 @@ namespace InnertubeService
' Under server-driven ABR the TV client can withhold every adaptive format URL (stuck
' at 360p); the downgraded TV client is not served SABR. Retry once with it.
if client = Innertube.ClientType.Tv and IsSabrLocked(playerResponseJson)
LogInfo("SABR-locked response, retrying with downgraded TV client...")
client = Innertube.ClientType.TvDowngraded
continue while
else if client = Innertube.ClientType.TvDowngraded and not HasUsableAdaptiveUrl(playerResponseJson)
@@ -146,14 +147,11 @@ namespace InnertubeService
end function
' True when the TV client's response is SABR-locked: server-driven ABR signaled with no usable
' adaptive URL (non-live VOD with streamingData).
' adaptive URL.
function IsSabrLocked(playerResponseJson as object) as boolean
if not IsAssociativeArray(ObjectUtils.Dig(playerResponseJson, ["streamingData"]))
return false
end if
if ValidBool(ObjectUtils.Dig(playerResponseJson, ["videoDetails", "isLive"]))
return false
end if
serverDrivenAbr = ValidBool(ObjectUtils.Dig(playerResponseJson, ["playerConfig", "mediaCommonConfig", "useServerDrivenAbr"]))
locked = serverDrivenAbr and not HasUsableAdaptiveUrl(playerResponseJson)
#if DEBUG
@@ -1,26 +1,28 @@
import "pkg:/components/Services/Innertube/SessionData.bs"
import "pkg:/source/utils/StringUtils.bs"
@job("InnertubeSessionDataJob")
function ExecuteJob() as void
input = JobGetInput()
innertubeNode = JobGetInput().innertube
innertubeNode = input.innertube
cancellation = JobGetCancellation()
sessionData = Innertube.GetSessionData(cancellation)
if sessionData.error <> invalid
JobError(sessionData.error)
return
cached = Innertube.ReadSessionDataFromRegistry()
if cached <> invalid and not StringUtils.IsNullOrEmpty(cached.visitorData)
if IsInt(cached.timestamp)
innertubeNode.timestamp = cached.timestamp
end if
innertubeNode.visitorData = cached.visitorData
if Innertube.IsSessionDataFresh(cached)
return
end if
end if
innertubeNode.queueFields(true)
if IsInt(sessionData.timestamp)
innertubeNode.timestamp = sessionData.timestamp
fetched = Innertube.RequestSessionData(JobGetCancellation())
if fetched <> invalid
Innertube.SaveSessionDataToRegistry(fetched)
innertubeNode.timestamp = fetched.timestamp
innertubeNode.visitorData = fetched.visitorData
else if StringUtils.IsNullOrEmpty(innertubeNode.visitorData)
' Refresh failed and we never had an id — wake a cold waiter to fail. Never blank a valid id.
innertubeNode.visitorData = ""
end if
if not StringUtils.IsNullOrEmpty(sessionData.visitorData)
innertubeNode.visitorData = sessionData.visitorData
end if
innertubeNode.queueFields(false)
end function
@@ -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)
@@ -11,18 +11,12 @@ namespace Innertube
const SESSION_DATA_VERSION = 1
const INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS = 60 * 60 * 24 * 14 ' 14 days
function GetSessionData(cancellation = invalid as object) as object
sessionData = ReadSessionDataFromRegistry()
if sessionData <> invalid
return sessionData
function IsSessionDataFresh(sessionData as object) as boolean
if sessionData = invalid or not IsInt(sessionData.timestamp)
return false
end if
sessionData = RequestSessionData(cancellation)
if sessionData.error <> invalid
return sessionData
end if
SaveSessionDataToRegistry(sessionData)
return sessionData
nowSeconds = TimeUtils.Now().AsSeconds()
return nowSeconds - sessionData.timestamp <= INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS
end function
function RequestSessionData(cancellation = invalid as object) as object
@@ -35,12 +29,12 @@ namespace Innertube
})
request.Cancellation(cancellation)
request.TryCount(2)
request.NoCache()
response = request.Await()
if not response.IsSuccess()
return {
"error": "Failed to fetch session data: " + response.ErrorMessage()
}
LogError("Failed to fetch session data: " + response.ErrorMessage())
return invalid
end if
text = response.Text()
@@ -48,16 +42,14 @@ namespace Innertube
json = StringUtils.ParseJsonSafe(text)
if json = invalid
return {
"error": "Failed to parse session data: " + text
}
LogError("Failed to parse session data: " + text)
return invalid
end if
visitorData = ObjectUtils.Dig(json, [0, 2, 0, 0, 13])
if StringUtils.IsNullOrEmpty(visitorData)
return {
"error": "Failed to find visitorData in session data: " + text
}
LogError("Failed to find visitorData in session data: " + text)
return invalid
end if
return {
@@ -84,13 +76,7 @@ namespace Innertube
return invalid
end if
timestamp = sessionData.timestamp
nowSeconds = TimeUtils.Now().AsSeconds()
if nowSeconds - timestamp > INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS
RegistryUtils.Delete(RegistryUtils.INNERTUBE_SESSION_DATA)
return invalid
end if
return sessionData
end function
end namespace
@@ -70,6 +70,7 @@ class LoungeApi
commandHandlers[COMMAND_TYPE_SEND_DEBUG_COMMAND] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_SET_AUTOPLAY_MODE] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_GET_PARTY_GAMES_MODE] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_SET_IMPACTED_SESSIONS_SERVER_EVENT] = m.HandleIgnoreCommand
commandHandlers[COMMAND_TYPE_GET_NOW_PLAYING] = m.HandleGetPlayingNow
commandHandlers[COMMAND_TYPE_SESSION_ID] = m.HandleSessionId
@@ -35,6 +35,7 @@ const COMMAND_TYPE_SEND_DEBUG_COMMAND = "sendDebugCommand"
const COMMAND_TYPE_SET_AUTOPLAY_MODE = "setAutoplayMode"
const COMMAND_TYPE_SET_PLAYBACK_SPEED = "setPlaybackSpeed"
const COMMAND_TYPE_GET_PLAYBACK_SPEED = "getPlaybackSpeed"
const COMMAND_TYPE_SET_IMPACTED_SESSIONS_SERVER_EVENT = "setImpactedSessionsServerEvent"
' Special commands
const COMMAND_TYPE_SESSION_ID = "c"
const COMMAND_TYPE_G_SESSION_ID = "S"
@@ -1,5 +1,7 @@
import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/CancellationUtils.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
@job("VideoContentJob")
function ExecuteJob() as void
@@ -32,19 +34,15 @@ function ExecuteJob() as void
if not IsAssociativeArray(metadata)
cancellation = JobGetCancellation()
if backend = "playlet"
visitorData = innertubeNode.visitorData
if StringUtils.IsNullOrEmpty(visitorData)
messagePort = CreateObject("roMessagePort")
MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "visitorData", messagePort)
innertubeNode.requestVisitorData = true
message = wait(20000, messagePort)
innertubeNode.unobserveFieldScoped("visitorData")
if message = invalid
innertubeNode.forceRequestVisitorData = true
JobError("Failed to get visitor data. Please try again later.")
return
end if
visitorData = message.getData()
visitorData = GetVisitorData(innertubeNode, cancellation)
if visitorData.cancel = true
JobCancel()
return
end if
if visitorData.error <> invalid
JobError(visitorData.error)
return
end if
accessToken = invalid
@@ -58,10 +56,16 @@ function ExecuteJob() as void
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
"cancellation": cancellation
"credentialTransferToken": loungeServiceNode.credentialTransferToken
"visitorData": visitorData
"visitorData": visitorData.visitorData
"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
@@ -154,6 +158,48 @@ function ExecuteJob() as void
end if
end function
function GetVisitorData(innertubeNode as object, cancellation as object) as object
port = CreateObject("roMessagePort")
MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "visitorData", port)
CancellationUtils.ObserveCancellationScoped(cancellation, port)
visitorData = innertubeNode.visitorData
if not StringUtils.IsNullOrEmpty(visitorData)
innertubeNode.unobserveFieldScoped("visitorData")
CancellationUtils.UnobserveCancellationScoped(cancellation)
return {
visitorData: visitorData
}
end if
innertubeNode.requestVisitorData = true
message = wait(30000, port)
innertubeNode.unobserveFieldScoped("visitorData")
CancellationUtils.UnobserveCancellationScoped(cancellation)
if message <> invalid
if CancellationUtils.IsCancellationEvent(cancellation, message)
return {
cancel: true
}
end if
visitorData = message.getData()
end if
if StringUtils.IsNullOrEmpty(visitorData)
return {
error: "Failed to get visitor data. Please try again later."
}
end if
return {
visitorData: visitorData
}
end function
function CreateStreamUrls(metadata as object, service as Invidious.InvidiousService, preferences as object, backend as string, playletServerPort as integer) as object
instance = service.GetInstance()
proxyVideos = preferences["invidious.proxy_videos"]
@@ -342,6 +388,10 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
end if
isoLanguageList = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json5"))
if not IsAssociativeArray(isoLanguageList)
LogError("Failed to load ISO-639 language map; skipping captions")
return
end if
instance = service.GetInstance()
subtitleTracks = []
@@ -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
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=47
build_version=00003
build_version=00004
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.47.3",
"version": "0.47.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.47.3",
"version": "0.47.4",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/postcss": "^4.3.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.47.3",
"version": "0.47.4",
"type": "module",
"scripts": {
"dev": "vite",