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");
        }
示例#2
0
        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);
        }
示例#3
0
        public ActionResult GetRiverJs(string name)
        {
            var syndications = SyndicationRiverJsCache.Get(name, HttpContext.Cache);

            if (syndications == null)
            {
                var id = SyndicationList.NewId(name);
                var list = RavenSession.Load<SyndicationList>(id.Full());

                if (list != null)
                {
                    var subscription = list.Sources;
                    var fetcher = new SyndicationFetcher();
                    var feeds = fetcher.DownloadAll(subscription);

                    var river = FeedsRiver.FromSyndication(feeds, CutoffDate());

                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(river, JsonSettings.Get());
                    var jsonp = "onGetRiverStream (" + jsonString + ")";

                    SyndicationRiverJsCache.Store(name, jsonp, HttpContext.Cache);
                    this.Compress();
                    return Content(jsonp, "application/json");
                }
                else
                    return HttpNotFound();

            }
            else
            {
                this.Compress();
                return Content(syndications, "application/json");
            }
        }