diff --git a/CHANGELOG.md b/CHANGELOG.md index e4f22d74..18a738c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing worth mentioning yet. +### Fixed + +- Improve channel parsing in Recommended feed ## [0.43.2] - 2025-10-29 diff --git a/playlet-lib/src/components/Services/Innertube/NodesParser.bs b/playlet-lib/src/components/Services/Innertube/NodesParser.bs index 342fa75a..bbd56c2b 100644 --- a/playlet-lib/src/components/Services/Innertube/NodesParser.bs +++ b/playlet-lib/src/components/Services/Innertube/NodesParser.bs @@ -1397,7 +1397,7 @@ namespace Innertube else if contentType = "TILE_CONTENT_TYPE_PLAYLIST" return TileRendererTypePlaylist(nodeData, context) else if contentType = "TILE_CONTENT_TYPE_CHANNEL" - ' Not implemented yet - https://github.com/iBicha/playlet/issues/724 + return TileRendererTypeChannel(nodeData, context) else if contentType = "TILE_CONTENT_TYPE_EDU" ' Not implemented yet - https://github.com/iBicha/playlet/issues/751 end if @@ -1599,6 +1599,42 @@ namespace Innertube return invalid end function + function TileRendererTypeChannel(nodeData as object, context as object) as object + channelId = nodeData["contentId"] + if not IsString(channelId) + Warning("Invalid channel ID in tileRendererTypeChannel", nodeData, context) + return invalid + end if + + ' TODO:P1 Channel IDs starting with "SC" are shows, not supported yet. + if channelId.StartsWith("SC") + LogWarnNoTelemetry("Shows are not supported yet in TileRendererTypeChannel") + return invalid + end if + + renderedLines = [] + lines = ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "lines"]) + if IsArray(lines) + for each line in lines + if not IsAssociativeArray(line) + continue for + end if + renderedLines.Push(ParseLineRenderer(line["lineRenderer"])) + end for + end if + + channel = { + "type": "channel" + "authorId": channelId + "author": ParseText(ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "title"])) + "authorThumbnails": ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnail", "thumbnails"]) + "lines": renderedLines + } + + PushFeedItem(channel, context) + return invalid + end function + function ParseTileRendererAuthorId(nodeData 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.