Skip to content

Commit

Permalink
fix(innertube): wrong playlist song artist
Browse files Browse the repository at this point in the history
  • Loading branch information
z-huang committed Aug 27, 2024
1 parent e6e8e4a commit eb9cc38
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,17 @@ data class PlaylistPage(
) {
companion object {
fun fromMusicResponsiveListItemRenderer(renderer: MusicResponsiveListItemRenderer): SongItem? {
val artists = renderer.flexColumns.getOrNull(1)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.oddElements()?.map {
Artist(
name = it.text,
id = it.navigationEndpoint?.browseEndpoint?.browseId,
)
}
val collaborators = renderer.flexColumns.getOrNull(2)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.oddElements()?.map {
Artist(
name = it.text,
id = it.navigationEndpoint?.browseEndpoint?.browseId,
)
}

return SongItem(
id = renderer.playlistItemData?.videoId ?: return null,
title = renderer.flexColumns.firstOrNull()
?.musicResponsiveListItemFlexColumnRenderer?.text
?.runs?.firstOrNull()?.text ?: return null,
artists = (artists.orEmpty() + collaborators.orEmpty()).ifEmpty { return null },
artists = renderer.flexColumns.getOrNull(1)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.oddElements()?.map {
Artist(
name = it.text,
id = it.navigationEndpoint?.browseEndpoint?.browseId,
)
}.orEmpty().ifEmpty { return null },
album = renderer.flexColumns.getOrNull(2)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.firstOrNull()?.let {
Album(
name = it.text,
Expand Down

0 comments on commit eb9cc38

Please sign in to comment.