iTunes Podcast Finder is a .NET Standard 2.0 library that allows you to search for podcasts through the iTunes API and get episodes of podcasts from the RSS feed. Get the Nuget package.
PM> Install-Package Luandersonn.iTunesPodcastFinder
- Search podcasts from iTunes
- Get the list of the most popular podcasts by country and genre
- Get podcast by iTunes ID
- Get podcast and episodes from the RSS feed URL
PodcastFinder finder = new PodcastFinder();
// Default: retrieve 100 items using the US search
IEnumerable<Podcast> results = await finder.SearchPodcastsAsync("Games");
foreach (Podcast podcast in results)
{
Debug.WriteLine($"Name = {podcast.Name}");
Debug.WriteLine($"Editor = {podcast.Editor}");
Debug.WriteLine($"Genre = {podcast.Genre}");
}
int maxItems = 30; // Min:1 - max:200
string country = "br" // Two-letter country code (ISO 3166-1 alpha-2)
// Results optimized for Brazil
IEnumerable<Podcast> results = await finder.SearchPodcastsAsync("Games", maxItems, country);
foreach (Podcast podcast in results)
{
Debug.WriteLine($"Name = {podcast.Name}");
Debug.WriteLine($"Editor = {podcast.Editor}");
Debug.WriteLine($"Genre = {podcast.Genre}");
}
// Get the 100 most popular podcasts from the US in Games & Hobbies category
IEnumerable<Podcast> results = await finder.GetTopPodcastsAsync(PodcastGenre.GamesAndHobbies);
foreach (Podcast podcast in results)
{
Debug.WriteLine($"Name = {podcast.Name}");
Debug.WriteLine($"Editor = {podcast.Editor}");
Debug.WriteLine($"Genre = {podcast.Genre}");
}
โ WARNING: In this method, the resolution of the art images of the podcasts is 170x170 and the feedUrl is null, this is a behavior of the iTunes API!. To get better resolution images and feedUrl, use the
GetPodcastAsync
method with the iTunes ID
string iTunesID = "1200361736"; // ID from 'The Daily' Podcast
Podcast podcast = await finder.GetPodcastAsync(iTunesID);
Debug.WriteLine($"Name = {podcast.Name}"); // The Daily
Debug.WriteLine($"Editor = {podcast.Editor}"); // The New York Times
Debug.WriteLine($"Genre = {podcast.Genre}"); // News & Politics
You can get the iTunes ID with the pocast link from iTunes using the static method
Podcast class now has iTunesId property.PodcastFinder.GetItunesID(iTunesLink)
IEnumerable<Podcast> brazilTopPodcasts = await finder.GetTopPodcastsAsync(PodcastGenre.All, 50, "br");
Podcast mostPopularPodcast = brazilTopPodcasts.First();
Podcast podcast = await finder.GetPodcastAsync(mostPopularPodcast.ItunesId);
Debug.WriteLine($"Name = {podcast.Name}");
Debug.WriteLine($"Editor = {podcast.Editor}");
Debug.WriteLine($"Genre = {podcast.Genre}");
If you have a RSS feed URL of a podcast and want to get the episodes...
string feedUrl = "http://rss.art19.com/the-daily";
PodcastRequestResult result = await finder.GetPodcastEpisodesAsync(feedUrl);
Debug.WriteLine($"Podcast name = {result.Podcast.Name}");
foreach (PodcastEpisode episode in result.Episodes)
{
Debug.WriteLine($"Episode number = {episode.EpisodeNumber}");
Debug.WriteLine($"Title = {episode.Title}");
Debug.WriteLine($"Summary = {episode.Summary}");
Debug.WriteLine($"Published Date = {episode.PublishedDate}");
// In some cases, the duration is not reported by the RSS feed.
// In these scenarios, the 'Duration' value is "00:00:00"
Debug.WriteLine($"Duration = {episode.Duration}");
}