// public static RSSList GetRssFeed() public static List <RSS> GetRssFeed(String _blogURL) { List <RSS> RSSitems = new List <RSS>(); RSSList myRSS = new RSSList(); var reader = new FeedReader(); var items = reader.RetrieveFeed(_blogURL); //("http://www.nytimes.com/services/xml/rss/nyt/International.xml"); foreach (var i in items) { RSSitems.Add(new Models.RSS(i.Uri.ToString(), i.Date.ToString(), i.Title, i.Summary)); } return(RSSitems); }
public static List <RSS> GetAllRssFeeds(String CollectionName) { List <RSS> RSSitems = new List <RSS>(); RSSList myRSS = new RSSList(); List <String> Urls = new List <string>(); var reader = new FeedReader(); Urls = GetCollectionUrls(CollectionName); List <List <RSS> > NotSortedFeedList = new List <List <RSS> >(); foreach (var feedurl in Urls) { List <RSS> Temp = new List <RSS>(); var items = reader.RetrieveFeed(feedurl);//("http://www.nytimes.com/services/xml/rss/nyt/International.xml"); foreach (var i in items) { Temp.Add(new Models.RSS(i.Uri.ToString(), i.Date.ToString(), i.Title, i.Summary)); } NotSortedFeedList.Add(Temp); } int max = 0;//максимальное количество постов в фиде foreach (var feed in NotSortedFeedList) { int i = 0; foreach (var post in feed) { i++; } if (i > max) { max = i; } } //----------------- //начальное значение Pstop (2) - это количество постов от одного фида в группке: int Pstop = 2; int Pstart = 0;//индексы первого и последнего постов в группке for (Pstop = 2; Pstop < max; Pstop += 2) { foreach (var feed in NotSortedFeedList) { for (int post_i = Pstart; post_i < Pstop; post_i++) { try { if (feed[post_i] != null) { RSSitems.Add(feed[post_i]); } } catch (Exception) { }; } } Pstart += 2; } return(RSSitems); }