Example #1
0
        //var url = document.Root.Element("channel").Element("item").Element("enclosure").Attribute("url").Value;



        public static List <Episode> GetEpisodes(string url)
        {
            SyndicationFeed feed     = RSSReader.Reader(url);
            List <Episode>  episodes = new List <Episode>();

            var listURL = new List <string>();

            var document = XDocument.Load(url);

            foreach (var item in document.Descendants("item"))
            {
                var namnURL = item.Name.ToString();
                var urln    = item.Element("enclosure").Attribute("url").Value;
                listURL.Add(urln);
            }

            if (Validator.IsNotNull(feed))
            {
                int episodeCounter = feed.Items.ToList().Count;

                int i = 0;

                foreach (var item in feed.Items.ToList())
                {
                    episodes.Add(new Episode(episodeCounter, item.Title.Text, item.Summary.Text, listURL[i]));
                    episodeCounter--;
                    i++;
                }
            }
            return(episodes);
        }
Example #2
0
        private static string GetTitle(string url)
        {
            SyndicationFeed feed = RSSReader.Reader(url);

            if (Validator.IsNotNull(feed))
            {
                return(feed.Title.Text);
            }

            return(null);
        }
Example #3
0
        public static List <Episode> GetEpisodes(string url)
        {
            SyndicationFeed feed     = RSSReader.Reader(url);
            List <Episode>  episodes = new List <Episode>();

            if (Validator.IsNotNull(feed))
            {
                int episodeCounter = feed.Items.ToList().Count;

                foreach (var item in feed.Items.ToList())
                {
                    episodes.Add(new Episode(episodeCounter, item.Title.Text, item.Summary.Text));
                    episodeCounter--;
                }
            }
            return(episodes);
        }