Ejemplo n.º 1
0
        public static List <PodcastFeed> DeserializeFeeds(string json, IRssParser parser)
        {
            //Ex.
            //https://itunes.apple.com/lookup?id=278981407&entity=podcast
            var subscriptions = new List <PodcastFeed>();

            string feedUrl      = string.Empty;
            JToken rootToken    = JObject.Parse(json);
            JToken resultsToken = rootToken["results"];

            foreach (var subToken in resultsToken)
            {
                var sub = new PodcastFeed();
                sub.RssLink  = (string)subToken["feedUrl"];
                sub.Category = "Podcasts";
                sub.Title    = (string)subToken["collectionName"];
                sub.ImageUrl = (string)subToken["artworkUrl100"];
                sub.MaxItems = 0;
                parser.LoadPodcastFeed(sub, sub.MaxItems);

                subscriptions.Add(sub);
            }

            return(subscriptions);
        }
Ejemplo n.º 2
0
        private PodcastFeed GetiTunesPodcasts(PodcastGenre genre, uint limit)
        {
            var url = GetiTunesSourceUrl(genre, limit);

            var sourceSub = new PodcastFeed()
            {
                RssLink  = url,
                Title    = genre.ToString(),
                Category = "iTunes",
                MaxItems = limit,
            };

            _parser.LoadPodcastFeed(sourceSub, limit);

            return(sourceSub);
        }