public SyndicationList() { Participants = new List<string>(); Sources = new RssSubscription(); DateCreated = Stamp.Time(); LastModified = Stamp.Time(); }
public void TestSyndicationFetcher() { var opml = new Opml(); opml.LoadFromXML(_sampleOPML); var subscription = new RssSubscription(opml); var fetcher = new SyndicationFetcher(); var feeds = fetcher.DownloadAll(subscription); Assert.IsTrue(feeds.Count > 0, "All downloads must be bigger than zero"); }
public ActionResult Index(string url) { var uri = new Uri(url); var subFetcher = new SubscriptionFetcher(); var xml = subFetcher.Download(Texts.FromUriHost(uri), uri.PathAndQuery); var opml = new Opml(); opml.LoadFromXML(xml); var subscription = new RssSubscription(opml); var fetcher = new SyndicationFetcher(); var feeds = fetcher.DownloadAll(subscription); return Content("Feeds " + feeds.Count); }
/// <summary> /// Download all the latest RSS feed /// </summary> /// <param name="subscription"></param> /// <returns></returns> public List<FeedAndSource> DownloadAll(RssSubscription subscription) { var feeds = new SynchronizedCollection<FeedAndSource>(); var tasks = new List<Task>(); foreach (var sub in subscription.Items) { var r = Task.Factory.StartNew(() => { var res = Fetch(sub.XmlUri); if (res.IsFound) feeds.Add(new FeedAndSource(sub, res.Item)); }); tasks.Add(r); } Task.WaitAll(tasks.ToArray()); return feeds.ToList(); }
public void LoadFromOPML() { var opml = new Opml(); opml.LoadFromXML(_sample); var subscription = new RssSubscription(opml); Assert.IsTrue(subscription.Items.Count > 0); var item1 = subscription.Items.First(); Assert.IsNotNullOrEmpty(item1.Title); Assert.IsNotNullOrEmpty(item1.Text); Assert.IsNotNullOrEmpty(item1.Name); Assert.IsNotNullOrEmpty(item1.Description); Assert.IsNotNullOrEmpty(item1.HtmlUri.ToString()); Assert.IsNotNullOrEmpty(item1.XmlUri.ToString()); }