Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit e892918

Browse files
committed
🐛 Fix listMusiceFromPlaylist when the musics come from caroussel
1 parent ff4edf1 commit e892918

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/listMusicsFromPlaylist.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ export const parseListMusicsFromPlaylistBody = (body: {
1010
tabRenderer: {
1111
content: {
1212
sectionListRenderer: {
13-
contents: { musicPlaylistShelfRenderer: { contents: [] } }[];
13+
contents: {
14+
musicPlaylistShelfRenderer?: { contents: [] };
15+
musicCarouselShelfRenderer: { contents: [] };
16+
}[];
1417
};
1518
};
1619
};
1720
}[];
1821
};
1922
};
2023
}): MusicVideo[] => {
21-
const { contents } =
24+
const content =
2225
body.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content
23-
.sectionListRenderer.contents[0].musicPlaylistShelfRenderer;
26+
.sectionListRenderer.contents[0];
27+
const { contents } =
28+
content.musicPlaylistShelfRenderer ?? content.musicCarouselShelfRenderer;
2429

2530
const results: MusicVideo[] = [];
2631

@@ -37,7 +42,6 @@ export const parseListMusicsFromPlaylistBody = (body: {
3742
return results;
3843
};
3944

40-
4145
export async function listMusicsFromPlaylist(
4246
playlistId: string
4347
): Promise<MusicVideo[]> {
@@ -68,4 +72,3 @@ export async function listMusicsFromPlaylist(
6872
return [];
6973
}
7074
}
71-

0 commit comments

Comments
 (0)