Code Monkey home page Code Monkey logo

itunespodcastfinder's Introduction

iTunes Podcast Finder

iTunes logo

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

Features

Usage

PodcastFinder finder = new PodcastFinder();

Search

// 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}");
}		

Optimized search for another country

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 top podcasts

// 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

Get a podcast by 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 PodcastFinder.GetItunesID(iTunesLink) Podcast class now has iTunesId property.

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}");	

Get podcasts and episodes by RSS feed link

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}");
}

Dependencies

Newtonsoft.Json 12.0.2

itunespodcastfinder's People

Contributors

luandersonn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.