getEpisodesPlaylist method
- String playlistId = 'RDPN',
Get all episodes in an episodes playlist.
Currently the only known playlist is the "New Episodes" auto-generated playlist.
playlistId
Playlist ID, defaults to RDPN
, the id of the "New Episodes" playlist.
Returns Map in the format of getPodcast.
Implementation
Future<JsonMap> getEpisodesPlaylist({String playlistId = 'RDPN'}) async {
final browseId = playlistId.startsWith('VL') ? playlistId : 'VL$playlistId';
final body = {'browseId': browseId};
const endpoint = 'browse';
final response = await sendRequest(endpoint, body);
final playlist = parsePlaylistHeader(response);
final results =
nav(response, [
...TWO_COLUMN_RENDERER,
'secondaryContents',
...SECTION_LIST_ITEM,
...MUSIC_SHELF,
])
as JsonMap;
Future<List> parseFunc(contents) =>
parseContentList(contents as List<JsonMap>, parseEpisode, key: MMRIR);
playlist['episodes'] = parseFunc(results['contents']);
return playlist;
}