getChannel method
- String channelId
Get information about a podcast channel (episodes, podcasts).
For episodes, a maximum of 10 episodes are returned, the full list of episodes can be retrieved via getChannelEpisodes.
channelId
channel id.
Returns Map containing channel info.
Example:
{
"title": 'Stanford Graduate School of Business',
"thumbnails": [...]
"episodes":
{
"browseId": "UCGwuxdEeCf0TIA2RbPOj-8g",
"results":
[
{
"index": 0,
"title": "The Brain Gain: The Impact of Immigration on American Innovation with Rebecca Diamond",
"description": "Immigrants' contributions to America ...",
"duration": "24 min",
"videoId": "TS3Ovvk3VAA",
"browseId": "MPEDTS3Ovvk3VAA",
"videoType": "MUSIC_VIDEO_TYPE_PODCAST_EPISODE",
"date": "Mar 6, 2024",
"thumbnails": [...]
},
],
"params": "6gPiAUdxWUJXcFlCQ3BN..."
},
"podcasts":
{
"browseId": null,
"results":
[
{
"title": "Stanford GSB Podcasts",
"channel":
{
"id": "UCGwuxdEeCf0TIA2RbPOj-8g",
"name": "Stanford Graduate School of Business"
},
"browseId": "MPSPPLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9",
"podcastId": "PLxq_lXOUlvQDUNyoBYLkN8aVt5yAwEtG9",
"thumbnails": [...]
}
]
}
}
Implementation
Future<JsonMap> getChannel(String channelId) async {
final body = {'browseId': channelId};
const endpoint = 'browse';
final response = await sendRequest(endpoint, body);
final channel = <String, dynamic>{
'title': nav(response, [...HEADER_MUSIC_VISUAL, ...TITLE_TEXT]),
'thumbnails': nav(response, [...HEADER_MUSIC_VISUAL, ...THUMBNAILS]),
};
final results = nav(response, [...SINGLE_COLUMN_TAB, ...SECTION_LIST]);
channel.addAll(parser.parseChannelContents(results as List<JsonMap>));
return channel;
}