Compare commits

...
6 Commits
Author SHA1 Message Date
Brahim Hadriche 8051458df7 Release v0.40.2 (#650) 2025-06-11 21:47:03 -04:00
Brahim Hadriche 4dae928a03 [skip ci] remove no-op call for no caching 2025-06-10 13:43:53 -04:00
Brahim Hadriche d054dd64a5 Playlet backend channel sort options (#649)
* Playlet backend channel sort options

* tweak
2025-06-10 09:29:55 -04:00
Brahim Hadriche 68aeec3d6f Parse authorId from authenticated feeds (#648) 2025-06-09 19:38:51 -04:00
Brahim Hadriche fc2ffd8c23 Revert "[skip ci][perf] do not listen on tasks that have no callbacks" (#647)
* Revert "[skip ci][perf] do not listen on tasks that have no callbacks"

This reverts commit 0bc5ab6117.

* changelog
2025-06-09 16:25:27 -04:00
Brahim Hadriche 4906b69f4a [skip ci] small refactor 2025-06-09 16:19:47 -04:00
23 changed files with 240 additions and 92 deletions

No files matched your search

+11
View File
@@ -5,6 +5,17 @@ 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.40.2] - 2025-06-12
### Added
- Channel sort options in Playlet backend (sort videos by Newest, Oldest, Popular)
### Fixed
- [Perf] reverted a perf fix that wasn't helping
- A bug where "Open channel" didn't show up in videos and playlists from logged user
## [0.40.1] - 2025-06-07
### Added
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet",
"version": "0.40.1",
"version": "0.40.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.40.1",
"version": "0.40.2",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.32",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.40.1",
"version": "0.40.2",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.32",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.40.1",
"version": "0.40.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.40.1"
"version": "0.40.2"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.40.1",
"version": "0.40.2",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../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=40
build_version=00001
build_version=00002
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.40.1",
"version": "0.40.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.40.1"
"version": "0.40.2"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.40.1",
"version": "0.40.2",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -349,14 +349,17 @@ function GetSortingContextMenuOptionsForItem(video as object) as object
end if
feedSource = feedSources[0]
endpoint = feedSource.endpoint
if not m.sortOptions.DoesExist(endpoint)
return []
sortOptions = feedSource.state.sortOptions
if not IsArray(sortOptions)
endpoint = feedSource.endpoint
if not m.sortOptions.DoesExist(endpoint)
return []
end if
sortOptions = m.sortOptions[endpoint]
end if
title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`)
sortOptions = m.sortOptions[endpoint]
return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])]
end function
+3 -11
View File
@@ -44,19 +44,11 @@ function Update()
end if
if hours > 12
hours = hours - 12
hours -= 12
end if
hoursStr = hours.ToStr()
minutesStr = minutes.ToStr()
if hours < 10
hoursStr = "0" + hoursStr
end if
if minutes < 10
minutesStr = "0" + minutesStr
end if
hoursStr = hours.ToStr("%02d")
minutesStr = minutes.ToStr("%02d")
m.top.text = hoursStr + ":" + minutesStr + " " + ampm
end function
+4 -21
View File
@@ -143,27 +143,10 @@ function FormatTime(dateTime as object) as string
dateTime.Mark()
dateTime.ToLocalTime()
hours = dateTime.GetHours().ToStr()
if hours.Len() = 1
hours = "0" + hours
end if
minutes = dateTime.GetMinutes().ToStr()
if minutes.Len() = 1
minutes = "0" + minutes
end if
seconds = dateTime.GetSeconds().ToStr()
if seconds.Len() = 1
seconds = "0" + seconds
end if
milliseconds = dateTime.GetMilliseconds().ToStr()
if milliseconds.Len() = 1
milliseconds = "00" + milliseconds
else if milliseconds.Len() = 2
milliseconds = "0" + milliseconds
end if
hours = dateTime.GetHours().ToStr("%02d")
minutes = dateTime.GetMinutes().ToStr("%02d")
seconds = dateTime.GetSeconds().ToStr("%02d")
milliseconds = dateTime.GetMilliseconds().ToStr("%03d")
return "[" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + "]"
end function
@@ -12,12 +12,12 @@ const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20250520.05.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0"
const INNERTUBE_TV_BROWSER_NAME = "LG Browser"
const INNERTUBE_TV_BROWSER_VERSION = "7.00.00"
const INNERTUBE_TV_BROWSER_NAME = "SamsungBrowser"
const INNERTUBE_TV_BROWSER_VERSION = "9.2"
const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20250519.12.01"
const INNERTUBE_TV_DEVICE_MAKE = "LGE"
const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU"
const INNERTUBE_TV_OS_NAME = "webOS"
const INNERTUBE_TV_OS_VERSION = "2015"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)"
const INNERTUBE_TV_DEVICE_MAKE = "Samsung"
const INNERTUBE_TV_DEVICE_MODEL = "SmartTV"
const INNERTUBE_TV_OS_NAME = "Tizen"
const INNERTUBE_TV_OS_VERSION = "4.0.0.2"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0(SMART-TV; Linux; Tizen 4.0.0.2) AppleWebkit/605.1.15 (KHTML, like Gecko) SamsungBrowser/9.2 TV Safari/605.1.15"
@@ -25,7 +25,6 @@ namespace InnertubeService
playerRequest.Cancellation(cancellation)
if raw
playerRequest.LogCurlCommand()
playerRequest.NoCache()
end if
playerRequest.Send()
@@ -36,7 +35,6 @@ namespace InnertubeService
nextRequest.Cancellation(cancellation)
if raw
nextRequest.LogCurlCommand()
nextRequest.NoCache()
end if
nextRequest.Send()
end if
@@ -81,8 +81,10 @@ namespace Innertube
"gridRenderer": ParseGridRenderer
"richGridRenderer": ParseRichGridRenderer
"richItemRenderer": ParseRichItemRenderer
"feedFilterChipBarRenderer": ParseFeedFilterChipBarRenderer
"continuationItemRenderer": ParseContinuationItemRenderer
"appendContinuationItemsAction": ParseAppendContinuationItemsAction
"reloadContinuationItemsCommand": ParseReloadContinuationItemsCommand
"gridContinuation": ParseGridContinuation
"tvSurfaceContentContinuation": ParseTvSurfaceContentContinuation
' Ignored nodes:
@@ -144,7 +146,26 @@ namespace Innertube
return nodeData["content"]
end function
function ParseSectionListRenderer(nodeData as object, _context as object) as object
function ParseSectionListRenderer(nodeData as object, context as object) as object
sortSubMenuItems = ObjectUtils.Dig(nodeData, ["subMenu", "channelSubMenuRenderer", "sortSetting", "sortFilterSubMenuRenderer", "subMenuItems"])
if IsArray(sortSubMenuItems)
sortOptions = []
for each item in sortSubMenuItems
params = ValidString(ObjectUtils.Dig(item, ["navigationEndpoint", "browseEndpoint", "params"]))
title = ParseText(item["title"])
isSelected = ValidBool(item["selected"])
if params <> "" and title <> ""
sortOptions.Push({
"title": title
"params": params
"isSelected": isSelected
})
end if
end for
if sortOptions.Count() > 0
context.currentFeed.sortOptions = sortOptions
end if
end if
return nodeData["contents"]
end function
@@ -1064,6 +1085,11 @@ namespace Innertube
"percentDurationWatched": percentDurationWatched
}
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
video["authorId"] = authorId
end if
PushFeedItem(video, context)
return invalid
end function
@@ -1107,6 +1133,11 @@ namespace Innertube
"videoThumbnails": videoThumbnails
}
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
video["authorId"] = authorId
end if
PushFeedItem(video, context)
return invalid
end function
@@ -1149,10 +1180,37 @@ namespace Innertube
"lines": renderedLines
}
authorId = ParseTileRendererAuthorId(nodeData, context)
if authorId <> invalid
playlist["authorId"] = authorId
end if
PushFeedItem(playlist, context)
return invalid
end function
function ParseTileRendererAuthorId(nodeData as object, context as object) as dynamic
' We're checking in the long press menu if there's a browseId that starts with "UC".
' This is usually the the id of the channel.
menuItems = ObjectUtils.Dig(nodeData, ["onLongPressCommand", "showMenuCommand", "menu", "menuRenderer", "items"])
if not IsArray(menuItems)
return invalid
end if
for each item in menuItems
if not IsAssociativeArray(item) or not item.DoesExist("menuNavigationItemRenderer")
continue for
end if
menuNavigationItemRenderer = item["menuNavigationItemRenderer"]
browseId = ObjectUtils.Dig(menuNavigationItemRenderer, ["navigationEndpoint", "browseEndpoint", "browseId"])
if not IsString(browseId) or not browseId.StartsWith("UC")
continue for
end if
return browseId
end for
return invalid
end function
function ParseGridRenderer(nodeData as object, context as object) as object
continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
if IsString(continuation)
@@ -1161,7 +1219,11 @@ namespace Innertube
return nodeData["items"]
end function
function ParseRichGridRenderer(nodeData as object, _context as object) as object
function ParseRichGridRenderer(nodeData as object, context as object) as object
feedFilterChipBarRenderer = ObjectUtils.Dig(nodeData, ["header", "feedFilterChipBarRenderer"])
if feedFilterChipBarRenderer <> invalid
ParseFeedFilterChipBarRenderer(feedFilterChipBarRenderer, context)
end if
return nodeData["contents"]
end function
@@ -1169,6 +1231,47 @@ namespace Innertube
return nodeData["content"]
end function
function ParseFeedFilterChipBarRenderer(nodeData as object, context as object) as object
contents = ObjectUtils.Dig(nodeData, ["contents"])
if not IsArray(contents)
return invalid
end if
sortOptions = []
for each item in contents
if not IsAssociativeArray(item) or not item.DoesExist("chipCloudChipRenderer")
continue for
end if
chipCloudChipRenderer = item["chipCloudChipRenderer"]
if not IsAssociativeArray(chipCloudChipRenderer)
continue for
end if
continuationCommand = ObjectUtils.Dig(chipCloudChipRenderer, ["navigationEndpoint", "continuationCommand"])
if not IsAssociativeArray(continuationCommand) or ValidString(continuationCommand["request"]) <> "CONTINUATION_REQUEST_TYPE_BROWSE"
continue for
end if
title = ParseText(chipCloudChipRenderer["text"])
token = ValidString(continuationCommand["token"])
isSelected = ValidBool(chipCloudChipRenderer["isSelected"])
if title = "" or token = ""
continue for
end if
sortOptions.Push({
"title": title
"continuation": token
"isSelected": isSelected
})
end for
if sortOptions.Count() > 0
context.currentFeed.sortOptions = sortOptions
end if
return invalid
end function
function ParseContinuationItemRenderer(nodeData as object, context as object) as object
continuation = ObjectUtils.Dig(nodeData, ["continuationEndpoint", "continuationCommand", "token"])
if IsString(continuation)
@@ -1185,6 +1288,10 @@ namespace Innertube
return nodeData["continuationItems"]
end function
function ParseReloadContinuationItemsCommand(nodeData as object, _context as object) as object
return nodeData["continuationItems"]
end function
function ParseGridContinuation(nodeData as object, context as object) as object
continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
if IsString(continuation)
@@ -141,12 +141,16 @@ namespace Innertube
items = []
continuation = invalid
sortOptions = invalid
feeds = ParseResponseDataForFeeds(responseData, { "currentAuthor": author, "currentAuthorId": authorId })
if feeds.Count() > 0
items = ValidArray(feeds[0].items)
if feeds[0].DoesExist("continuation")
continuation = feeds[0].continuation
end if
if feeds[0].DoesExist("sortOptions")
sortOptions = feeds[0].sortOptions
end if
end if
channel = {
@@ -161,9 +165,13 @@ namespace Innertube
"items": items
}
' continuation and sort options are specific to certain tabs of the channel
if continuation <> invalid
channel["continuation"] = continuation
end if
if sortOptions <> invalid
channel["sortOptions"] = sortOptions
end if
return channel
end function
@@ -487,6 +487,7 @@ namespace Invidious
return {
items: json.videos
continuation: json.continuation
sortOptions: json.sortOptions
}
end if
return invalid
@@ -510,6 +511,7 @@ namespace Invidious
return {
items: json.playlists
continuation: json.continuation
sortOptions: json.sortOptions
}
end if
return invalid
@@ -129,6 +129,10 @@ function VideoRowListRowContentTask(input as object) as object
hasContinuation = not StringUtils.IsNullOrEmpty(response.result.continuation)
feedSource.state.continuation = ValidString(response.result.continuation)
if response.result.sortOptions <> invalid
feedSource.state.sortOptions = response.result.sortOptions
end if
if addedItemCount > 0
pageType = feedSource.state.paginationType
if response.result.isLastPage = true or (hadContinuation and not hasContinuation)
@@ -735,6 +735,24 @@ namespace Http
options.params = params
end if
' sort by is a special sorting argument handled by Playlet backend.
' It's a JSON object that could have the "params" key or "continuation"
' key. In this case, we will override these options with the values
' from the "sort_by" query parameter. If we do get an Invidious "sort_by"
' (such as "newest", "oldest", etc.), we'll ignore it, as it is not supported.
sortBy = request.query.sort_by
if not StringUtils.IsNullOrEmpty(sortBy) and sortBy.StartsWith("{")
sortBy = ParseJson(sortBy)
if IsAssociativeArray(sortBy)
if sortBy.DoesExist("params")
options.params = sortBy.params
end if
if sortBy.DoesExist("continuation")
options.continuation = sortBy.continuation
end if
end if
end if
channel = InnertubeService.GetChannel(channelId, options)
if raw
response.Json(channel)
@@ -747,28 +765,52 @@ namespace Http
return true
end if
result = {}
if _tab = "playlists" or _tab = "podcasts" or _tab = "releases" or _tab = "courses"
result = {
"playlists": channel.items
}
if channel.DoesExist("continuation")
result.continuation = channel.continuation
end if
response.Json(result)
if channel.DoesExist("cache-control")
response.headers["cache-control"] = channel["cache-control"]
end if
result ["playlists"] = channel.items
else
result = {
"videos": channel.items
}
if channel.DoesExist("continuation")
result.continuation = channel.continuation
end if
response.Json(result)
if channel.DoesExist("cache-control")
response.headers["cache-control"] = channel["cache-control"]
result ["videos"] = channel.items
end if
if channel.DoesExist("continuation")
result.continuation = channel.continuation
end if
if channel.DoesExist("sortOptions")
' Transform sort options from:
' [{
' "title": "string",
' "isSelected": "boolean"
' "params?": "string",
' "continuation?": "string"
' }]
' to:
' [{
' "title": "string",
' "isSelected": "boolean"
' "params?": "string",
' "continuation?": "string"
' "id": "{ \"params\": \"string\", \"continuation\": \"string\" }"
' }]
' This so sorting doesn't interfere with actual params or continuation.
' Sort options are later parsed by Playlet backend.
sortOptions = channel.sortOptions
if IsArray(sortOptions) and sortOptions.Count() > 0
for i = 0 to sortOptions.Count() - 1
sortOption = sortOptions[i]
sortOptionId = {}
if sortOption.DoesExist("params")
sortOptionId["params"] = sortOption.params
end if
if sortOption.DoesExist("continuation")
sortOptionId["continuation"] = sortOption.continuation
end if
sortOption.id = FormatJson(sortOptionId)
end for
end if
result["sortOptions"] = sortOptions
end if
response.Json(result)
if channel.DoesExist("cache-control")
response.headers["cache-control"] = channel["cache-control"]
end if
return true
+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=40
build_version=00001
build_version=00002
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -14,10 +14,9 @@ namespace AsyncTask
task.id = id
task.input = input
if callback <> invalid
m[`asynctask_${id}_callback`] = callback
task.ObserveFieldScoped("state", FuncName(internal_OnTaskState))
end if
m[`asynctask_${id}`] = task
m[`asynctask_${id}_callback`] = callback
task.ObserveFieldScoped("state", FuncName(internal_OnTaskState))
return task
end function
@@ -40,6 +39,9 @@ namespace AsyncTask
end if
end if
task.input = invalid
task.output = invalid
m.delete(`asynctask_${id}`)
m.delete(`asynctask_${id}_callback`)
end function
+3 -7
View File
@@ -13,14 +13,10 @@ namespace TimeUtils
minutes = (length \ 60) mod 60
seconds = length mod 60
if seconds < 10
seconds = "0" + seconds.ToStr()
else
seconds = seconds.ToStr()
end if
seconds = seconds.ToStr("%02d")
if minutes < 10 and hours > 0
minutes = "0" + minutes.ToStr()
if hours > 0
minutes = minutes.ToStr("%02d")
else
minutes = minutes.ToStr()
end if
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.40.1",
"version": "0.40.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.40.1",
"version": "0.40.2",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"@tailwindcss/typography": "^0.5.16",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.40.1",
"version": "0.40.2",
"type": "module",
"scripts": {
"dev": "vite",