From eb9cc38492caca2de0d4c72332c08c779f7b14f7 Mon Sep 17 00:00:00 2001 From: Zion Huang Date: Wed, 28 Aug 2024 00:11:32 +0800 Subject: [PATCH] fix(innertube): wrong playlist song artist --- .../zionhuang/innertube/pages/PlaylistPage.kt | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/innertube/src/main/java/com/zionhuang/innertube/pages/PlaylistPage.kt b/innertube/src/main/java/com/zionhuang/innertube/pages/PlaylistPage.kt index b10121349..f746258e5 100644 --- a/innertube/src/main/java/com/zionhuang/innertube/pages/PlaylistPage.kt +++ b/innertube/src/main/java/com/zionhuang/innertube/pages/PlaylistPage.kt @@ -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,