diff --git a/CHANGELOG.md b/CHANGELOG.md index 026bd3cc..ba092dd7 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. +### Added + +- Implemented compactRadioRenderer node ## [0.43.9] - 2025-11-07 diff --git a/playlet-lib/src/components/Services/Innertube/NodesParser.bs b/playlet-lib/src/components/Services/Innertube/NodesParser.bs index bbd56c2b..7bd6736d 100644 --- a/playlet-lib/src/components/Services/Innertube/NodesParser.bs +++ b/playlet-lib/src/components/Services/Innertube/NodesParser.bs @@ -105,7 +105,7 @@ namespace Innertube ' "navigateAction": ParseNotImplemented ' TODO:P2 radioRenderer seems like a Mix https://github.com/iBicha/playlet/issues/709 "radioRenderer": ParseRadioRenderer - ' "compactRadioRenderer": ParseNotImplemented + "compactRadioRenderer": ParseCompactRadioRenderer ' TODO:P2 A carousel of videos, found on the home tab of a channel. ' Should probably be parsed. ' "carouselItemRenderer": ParseNotImplemented @@ -1025,6 +1025,36 @@ namespace Innertube return invalid end function + function ParseCompactRadioRenderer(nodeData as object, context as object) as object + playlistId = nodeData["playlistId"] + if not IsString(playlistId) + Warning("Invalid playlist ID in compactRadioRenderer", nodeData, context) + return invalid + end if + + videoCountText = ParseText(nodeData["videoCountText"]) + if videoCountText = "" + videoCountText = ParseText(nodeData["videoCountShortText"]) + end if + + playlist = { + "type": "playlist" + "playlistId": playlistId + "title": ParseText(nodeData["title"]) + "playlistThumbnail": ObjectUtils.Dig(nodeData, ["thumbnail", "thumbnails", 0, "url"]) + "videoCountText": videoCountText + } + + ' Mixes have a videoId, which is the first video in the mix + videoId = ObjectUtils.Dig(nodeData, ["navigationEndpoint", "watchEndpoint", "videoId"]) + if IsString(videoId) + playlist["videoId"] = videoId + end if + + PushFeedItem(playlist, context) + return invalid + end function + function ParseGridShelfViewModel(nodeData as object, _context as object) as object return nodeData["contents"] end function