Esempio n. 1
0
        public async Task <IReadOnlyCollection <RssLinkResource> > ParseFeedsAsync(IEnumerable <RssLink> input)
        {
            var rssFeeds = new List <RssLinkResource>();

            foreach (RssLink feed in input)
            {
                RssLinkResource resource = await ParseFeedAsync(feed);

                rssFeeds.Add(resource);
            }

            return(rssFeeds);
        }
Esempio n. 2
0
        private async Task <RssLinkResource> ParseFeedAsync(RssLink rssFeed)
        {
            SyndicationFeed feed = await CreateSyndicationFeedAsync(rssFeed.Url);

            string          description = rssFeed.Description ?? feed.Description?.Text;
            RssLinkResource resource    = new RssLinkResource
            {
                Id          = rssFeed.Id,
                FeedLink    = rssFeed.Url,
                Name        = feed.Title.Text,
                Description = description ?? "No description provided",
                ImageUrl    = feed.ImageUrl ?? null
            };

            return(resource);
        }