Skip to content

Commit

Permalink
fix(innertube): get queue title
Browse files Browse the repository at this point in the history
  • Loading branch information
z-huang authored and Malopieds committed Aug 27, 2024
1 parent bc8f42f commit 804ffbb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion innertube/src/main/java/com/malopieds/innertube/YouTube.kt
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ object YouTube {
endpoint.params,
continuation,
).body<NextResponse>()
val title = response.contents.singleColumnMusicWatchNextResultsRenderer.tabbedRenderer.watchNextTabbedResultsRenderer.tabs[0].tabRenderer.content?.musicQueueRenderer?.header?.musicQueueHeaderRenderer?.subtitle?.runs?.firstOrNull()?.text
val playlistPanelRenderer =
response.continuationContents?.playlistPanelContinuation
?: response.contents.singleColumnMusicWatchNextResultsRenderer.tabbedRenderer.watchNextTabbedResultsRenderer.tabs[0]
Expand All @@ -940,7 +941,7 @@ object YouTube {
?.let { watchPlaylistEndpoint ->
return@runCatching next(watchPlaylistEndpoint).getOrThrow().let { result ->
result.copy(
title = playlistPanelRenderer.title,
title = title,
items =
playlistPanelRenderer.contents.mapNotNull {
it.playlistPanelVideoRenderer?.let { renderer ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,21 @@ import kotlinx.serialization.Serializable
@Serializable
data class MusicQueueRenderer(
val content: Content?,
val header: Header?,
) {
@Serializable
data class Content(
val playlistPanelRenderer: PlaylistPanelRenderer,
)

@Serializable
data class Header(
val musicQueueHeaderRenderer: MusicQueueHeaderRenderer?,
) {
@Serializable
data class MusicQueueHeaderRenderer(
val title: Runs?,
val subtitle: Runs?,
)
}
}

0 comments on commit 804ffbb

Please sign in to comment.