Пример #1
0
        public string CacheFirstImageFromRSS(string URL)
        {
            HttpUtils httpCheck = new HttpUtils();

            string result = "";

            if (httpCheck.CheckConnection(URL) == true)
            {
                XmlReader rssReader = new CustomXmlReader(URL);

                SyndicationFeed feed = SyndicationFeed.Load(rssReader);

                //read item 0 (should be the most recent item)
                SyndicationItem item = First <SyndicationItem>(feed.Items);
                foreach (SyndicationLink link in item.Links)
                {
                    if (link.RelationshipType == "enclosure")
                    {
                        Uri imageURL = link.GetAbsoluteUri();
                        result = CacheImageFromWeb(imageURL, true);
                        return(result);
                    }
                }
            }
            return(result);
        }