public async Task <FeedDetails> GetFeedDetails(string url) { var content = await urlFetcher.Get(url); var feedParser = FeedParser.Create(content); var parsed = feedParser.Parse(); return(new FeedDetails { Name = parsed.Name }); }
public async Task <IReadOnlyList <ExternalFeedItem> > GetItems(Feed feed) { try { var content = await urlFetcher.Get(feed.url); var feedParser = FeedParser.Create(content); var parsed = feedParser.Parse(); return(parsed.Articles.Select(a => new ExternalFeedItem { Title = a.Title, Content = a.Content, Link = a.WebUri, PublishDate = a.Published }).ToList()); } catch (Exception exception) { Logger.Error("Error attempting to fetch feed items", new { feed, exception.Message }); return(null); } }