コード例 #1
0
        private void SaveItem(Uri feedUri, string title, DateTimeOffset publicationDate, Uri link)
        {
            var item = new SyndicationItem()
            {
                Title     = title,
                Published = publicationDate
            };

            item.AddLink(new SyndicationLink(link));
            _repository.Save(item, string.Empty, feedUri);
        }
コード例 #2
0
ファイル: RssDownloader.cs プロジェクト: Kntajus/Vigilant
        public async Task RetrieveItems(Uri feedUri)
        {
            var latestDate = _itemRepository.GetLatestPublicationDate(feedUri);

            var newItems = latestDate.HasValue ?
                           await _feedReader.GetItemsSince(feedUri, latestDate.Value) :
                           await _feedReader.GetMostRecentItems(feedUri, 10);

            foreach (var item in newItems)
            {
                // I don't know much about RSS, for simplicity I'm assuming there will always
                // be a link in the feed item and the first link will give me the actual article
                var articleUri = item.Links.First().Uri;
                var content    = await _articleReader.GetContent(articleUri);

                _itemRepository.Save(item, content, feedUri);
            }
        }