diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b99cc33..99233035 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 watch history and watch progress +- Channel sort ## [0.44.6] - 2026-02-08 diff --git a/playlet-lib/src/components/Services/Innertube/NodesParser.bs b/playlet-lib/src/components/Services/Innertube/NodesParser.bs index 070e4e48..a226b3c4 100644 --- a/playlet-lib/src/components/Services/Innertube/NodesParser.bs +++ b/playlet-lib/src/components/Services/Innertube/NodesParser.bs @@ -86,6 +86,7 @@ namespace Innertube "richGridRenderer": ParseRichGridRenderer "richItemRenderer": ParseRichItemRenderer "feedFilterChipBarRenderer": ParseFeedFilterChipBarRenderer + "chipBarViewModel": ParseChipBarViewModel "continuationItemRenderer": ParseContinuationItemRenderer "appendContinuationItemsAction": ParseAppendContinuationItemsAction "reloadContinuationItemsCommand": ParseReloadContinuationItemsCommand @@ -1720,13 +1721,64 @@ namespace Innertube end function function ParseRichGridRenderer(nodeData as object, context as object) as object - feedFilterChipBarRenderer = ObjectUtils.Dig(nodeData, ["header", "feedFilterChipBarRenderer"]) + header = nodeData["header"] + feedFilterChipBarRenderer = invalid + chipBarViewModel = invalid + if IsAssociativeArray(header) + feedFilterChipBarRenderer = header["feedFilterChipBarRenderer"] + chipBarViewModel = header["chipBarViewModel"] + end if + if feedFilterChipBarRenderer <> invalid ParseFeedFilterChipBarRenderer(feedFilterChipBarRenderer, context) + else if chipBarViewModel <> invalid + ParseChipBarViewModel(chipBarViewModel, context) end if return nodeData["contents"] end function + function ParseChipBarViewModel(nodeData as object, context as object) as object + chips = ObjectUtils.Dig(nodeData, ["chips"]) + if not IsArray(chips) + return invalid + end if + + sortOptions = [] + for each chip in chips + chipViewModel = chip["chipViewModel"] + if not IsAssociativeArray(chipViewModel) + continue for + end if + title = ValidString(chipViewModel["text"]) + isSelected = ValidBool(chipViewModel["selected"]) + token = invalid + tapCommand = chipViewModel["tapCommand"] + if IsAssociativeArray(tapCommand) + innertubeCommand = tapCommand["innertubeCommand"] + if IsAssociativeArray(innertubeCommand) + continuationCommand = innertubeCommand["continuationCommand"] + if IsAssociativeArray(continuationCommand) + token = ValidString(continuationCommand["token"]) + end if + end if + end if + if title = "" or StringUtils.IsNullOrEmpty(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 ParseRichItemRenderer(nodeData as object, _context as object) as object return nodeData["content"] end function