public RetrieveFeed ( |
||
xmlReader | The |
|
Résultat | IEnumerable |
List<ArticleViewModel> IFeedService.GetFeedFor(Uri feedAddress) { var results = new List<ArticleViewModel>(); var reader = new FeedReader(throwOnError: true); var articles = reader.RetrieveFeed(feedAddress.ToString()); foreach (var article in articles) { results.Add(new ArticleViewModel() { Title = article.Title, Content = article.Title, PublishDate = article.PublishDate }); } return results; }
protected List<SimpleFeedReader.FeedItem> GetArticles() { var reader = new FeedReader(); var items = reader.RetrieveFeed(Url); return items.ToList(); }
private IEnumerable<FeedItem> RetrieveFeeds(IEnumerable<Feed> feeds, TimeSpan ttl) { var items = new List<FeedItem>(); foreach (var f in feeds) { items.AddRange( HttpRuntime.Cache.GetOrStore<IEnumerable<FeedItem>>(string.Format("feed_{0}_{1}", f.Language, f.Uri.ToLowerInvariant()), () => { var reader = new FeedReader(new RobIIIFeedNormalizer()); return reader.RetrieveFeed(f.Uri); }, ttl) ); } return items.OrderByDescending(i => i.PublishDate); }
/// <summary> /// Checks for RSS feed updates, and posts on action /// </summary> public void RSSTracker(object sender, EventArgs e) { RSSTick.Close(); int count = 0; var reader = new FeedReader(); foreach (string item in Feeds) { var FeedItems = reader.RetrieveFeed(item); if (( (StoredFeeditems[count] != null) & (FeedItems != null) & (FeedItems.FirstOrDefault().Title.ToString() != StoredFeeditems[count]) & (EnableRSS = true) )) { Log.Interface(FeedItems.FirstOrDefault().Uri.ToString()); Bot.SteamFriends.SendChatRoomMessage(Groupchat, EChatEntryType.ChatMsg, FeedItems.FirstOrDefault().Title.ToString() + " " + FeedItems.FirstOrDefault().Uri.ToString()); } StoredFeeditems[count] = FeedItems.FirstOrDefault().Title.ToString(); count = count + 1; } RSSTimer(); }