コード例 #1
0
ファイル: FeedService.cs プロジェクト: AlexMerle/read-reco
        public int RefreshFeeds()
        {
            FeedRepository fRep  = new FeedRepository();
            List <Feed>    feeds = fRep.GetAll().Where(f => f.Active).ToList();

            int        addedItems = 0;
            FeedReader reader     = new FeedReader();

            foreach (Feed feed in feeds)
            {
                List <FeedItem> feedItems = reader.Read(feed.URL);
                foreach (FeedItem newItem in feedItems)
                {
                    if (feed.Items.Where(fi => fi.Id == newItem.Id).Count() == 0)
                    {
                        feed.Items.Add(newItem);
                        addedItems++;
                    }
                }
                feed.LastReadTime = DateTime.Now;
                fRep.Update(feed);
            }

            return(addedItems);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: kingsor/ProofOfConceptApps
        static void ShowRssFeeds()
        {
            string[] lines = File.ReadAllLines("./input.txt");

            foreach (string url in lines)
            {
                var feedUrl = GetFeedUrl(url);

                if (feedUrl == null)
                {
                    continue;
                }

                if (feedUrl.StartsWith("/"))
                {
                    feedUrl = string.Format("{0}{1}", url, feedUrl.Substring(1));
                }

                var feed = FeedReader.Read(feedUrl);

                Console.WriteLine("Feed Title: " + feed.Title);
                Console.WriteLine("Feed Description: " + feed.Description);
                Console.WriteLine("Feed Image: " + feed.ImageUrl);
                // ...
                foreach (var item in feed.Items)
                {
                    Console.WriteLine("* [{0}]({1})", item.Title, item.Link);
                }
            }

            Console.ReadLine();
        }
コード例 #3
0
        public void TestReadTheStudentLawyer()
        {
            var feed = FeedReader.Read("http://us10.campaign-archive.com/feed?u=8da2e137a07b178e5d9a71c2c&id=9134b0cc95");

            Assert.AreEqual("The Student Lawyer Careers Network Archive Feed", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #4
0
        public void TestReadRss20GermanFeed()
        {
            var    feed  = FeedReader.Read("http://content-wind.com/feed");
            string title = feed.Title;

            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #5
0
        public void TestReadRss10GermanFeed()
        {
            var    feed  = FeedReader.Read("http://rss.orf.at/news.xml");
            string title = feed.Title;

            Assert.IsTrue(feed.Items.Count > 10);
        }
コード例 #6
0
        public void TestReadAPOD()
        {
            var feed = FeedReader.Read("https://apod.nasa.gov/apod.rss");

            Assert.AreEqual("APOD", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #7
0
        public List <NewsItem> getFeed()
        {
            var             nationRF       = ConfigurationManager.AppSettings["Nation_RSS_FEED"];
            var             nation_RssFeed = FeedReader.Read(nationRF);
            List <NewsItem> newsItems      = new List <NewsItem>();


            foreach (var item in nation_RssFeed.Items)
            {
                NewsItem newsItem = new NewsItem();
                newsItem.Title       = item.Title;
                newsItem.Description = item.Description;
                newsItem.NewsChannel = nation_RssFeed.Description;
                var date = DateTime.ParseExact(
                    item.PublishingDateString,
                    "ddd, dd MMM yyyy HH:mm:ss K",
                    CultureInfo.InvariantCulture);
                newsItem.PublishedDate = date;

                newsItems.Add(newsItem);
                newsItem = null;
            }

            return(newsItems);
        }
コード例 #8
0
        public void TestReadStrategyEx()
        {
            var feed = FeedReader.Read("http://blog.strategyex.com/feed/");

            Assert.AreEqual("Strategy Execution Blog", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #9
0
        public void TestReadTechRep()
        {
            var feed = FeedReader.Read("http://www.techrepublic.com/rssfeeds/topic/project-management/");

            Assert.AreEqual("Project Management on TechRepublic", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #10
0
        public void TestReadTheLPM()
        {
            var feed = FeedReader.Read("https://thelazyprojectmanager.wordpress.com/feed/");

            Assert.AreEqual("The Lazy Project Manager's Blog", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #11
0
        public void TestReadMikeC()
        {
            var feed = FeedReader.Read("https://mikeclayton.wordpress.com/feed/");

            Assert.AreEqual("Shift Happens!", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #12
0
        public void TestReadTimeDoctor()
        {
            var feed = FeedReader.Read("https://blog.timedoctor.com/feed/");

            Assert.AreEqual("Time Doctor", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #13
0
        public void TestReadNoticiasCatolicas()
        {
            var feed = FeedReader.Read("feeds.feedburner.com/NoticiasCatolicasAleteia");

            Assert.AreEqual("Noticias Catolicas", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #14
0
        public void TestReadThaqafnafsak()
        {
            var feed = FeedReader.Read("http://www.thaqafnafsak.com/feed");

            Assert.AreEqual("ثقف نفسك", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #15
0
        public void TestReadLiveBold()
        {
            var feed = FeedReader.Read("http://feeds.feedburner.com/LiveBoldAndBloom");

            Assert.AreEqual("Live Bold and Bloom", feed.Title);
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #16
0
        static void Main(string[] args)
        {
            var rawFeeds = new[]
            {
                FeedReader.Read("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
            };

            var feeds = rawFeeds.Select(feed => new
            {
                feed.Title,
                Items = feed.Items.Select(item => new
                {
                    item.Title,
                    item.Content
                }).ToArray()
            }).ToArray();

            using (var luaWriter = LuaWriter.Create("SavedVariables.lua", new LuaWriterSettings {
                Indent = true
            }))
            {
                var luaSerializer = new LuaSerializer();

                luaWriter.WriteStartAssignment("FEED_READER_FEEDS");
                luaSerializer.Serialize(luaWriter, feeds);
                luaWriter.WriteEndAssignment();
            }
        }
コード例 #17
0
        public void TestReadAtomFeedHeise()
        {
            var feed = FeedReader.Read("https://www.heise.de/newsticker/heise-atom.xml");

            Assert.IsTrue(!string.IsNullOrEmpty(feed.Title));
            Assert.IsTrue(feed.Items.Count > 1);
        }
コード例 #18
0
        public void TestReadRss20GermanFeedPowershell()
        {
            var feed = FeedReader.Read("http://www.powershell.co.at/feed/");

            Assert.IsTrue(!string.IsNullOrEmpty(feed.Title));
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #19
0
        public void TestReadRssScottHanselmanWeb()
        {
            var feed = FeedReader.Read("http://feeds.hanselman.com/ScottHanselman");

            Assert.IsTrue(!string.IsNullOrEmpty(feed.Title));
            Assert.IsTrue(feed.Items.Count > 0);
        }
コード例 #20
0
        public void Read_Basic_ReturnsNonEmptyFeed()
        {
            var reader = new FeedReader(_sources);

            var source = reader.Read(_sources.First());

            Assert.IsNotNull(source);
        }
コード例 #21
0
        public void TestReadSimpleFeed()
        {
            var    feed  = FeedReader.Read("https://codehollow.com/feed");
            string title = feed.Title;

            Assert.AreEqual("codehollow", title);
            Assert.AreEqual(10, feed.Items.Count());
        }
コード例 #22
0
        public void TestAcceptHeaderForbiddenWithParsing()
        {
            // results in 403 Forbidden if webclient does not have the accept header set
            var    feed  = FeedReader.Read("http://www.girlsguidetopm.com/feed/");
            string title = feed.Title;

            Assert.IsTrue(feed.Items.Count > 2);
            Assert.IsTrue(!string.IsNullOrEmpty(title));
        }
コード例 #23
0
ファイル: Apk.cs プロジェクト: tylormclaughlin/foxbot
        public async Task DefaultApkAsync([Summary("Optional version number to search for.")] string versionNumber = "")
        {
            var  feed         = FeedReader.Read("https://www.apkmirror.com/apk/niantic-inc/pokemon-go/feed/").Items;
            bool validVersion = false;

            string[] splits = versionNumber.Split(".");

            //Return a list of all APK versions in the feed.
            if (versionNumber == "list")
            {
                EmbedBuilder eb = new EmbedBuilder();

                foreach (FeedItem item in feed)
                {
                    eb.AddField(item.Title, item.Link.Replace("-release/", "-android-apk-download/download/"));
                }

                await ReplyAsync("", false, eb);
            }
            else
            {
                //Try to make sure given version number was in a valid format (X.XX)
                if (versionNumber != "" && (splits.Length < 2 || (splits.Length < 3 && splits[1] == "")))
                {
                    await ReplyAsync("Sorry, I don't think that's a valid version number");
                }
                else
                {
                    //Need to do this because the FeedReader.Items collection doesn't have an indexer defined, making accessing specific items impossible without putting them in a list first.
                    foreach (var item in feed)
                    {
                        if (versionNumber != "")
                        {
                            if (item.Title.Contains(versionNumber))
                            {
                                validVersion = true;
                                await ReplyAsync(item.Title + " - " + item.Link.Replace("-release/", "-android-apk-download/download/")); //Change the link to point at the direct download

                                break;
                            }
                        }
                        else
                        {
                            await ReplyAsync(item.Title + " - " + item.Link.Replace("-release/", "-android-apk-download/download/"));

                            break;
                        }
                    }

                    if (!validVersion && versionNumber != "")
                    {
                        await ReplyAsync("Sorry, I couldn't find that version.");
                    }
                }
            }
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: slimhamdi95/Epione-JavaEE
        static public void save()
        {
            var          feed = FeedReader.Read("https://politepol.com/feed/35450");
            StreamWriter Sw   = new StreamWriter("Doctolib.txt");

            foreach (var item in feed.Items)
            {
                Sw.WriteLine(item.Title + " " + item.Description + "\n");
            }
            Sw.Close();
        }
コード例 #25
0
ファイル: News.cs プロジェクト: fossabot/Diademos
        public static Task <string[]> GetArticleUrls(string feedUrl)
        {
            List <string> articleUrlList = new List <string>();
            var           feed           = FeedReader.Read(HttpUtility.UrlDecode(feedUrl));

            foreach (var item in feed.Items)
            {
                articleUrlList.Add(item.Link);
            }
            return(Task.FromResult(articleUrlList.ToArray()));
        }
コード例 #26
0
 private void Validate(ChannelsCreateNewChannelRequest request)
 {
     try
     {
         FeedReader.Read(request.Url);
     }
     catch (Exception e)
     {
         throw new ItanValidationException(e);
     }
 }
コード例 #27
0
        private static Feed Read(string sourceId)
        {
            var source = _sources.Find(source => source.Id == sourceId);

            var reader  = new FeedReader(_sources);
            var rawFeed = reader.Read(source);

            var converter = new FeedConverter(_sources);
            var feed      = converter.Convert(source.Id, rawFeed);

            return(feed);
        }
コード例 #28
0
        public static void readFeed()
        {
            var feed = FeedReader.Read("https://www.pftq.com/forums/?type=rss;action=.xml;boards=72;limit=5");

            Console.WriteLine("Feed Title: " + feed.Title);
            Console.WriteLine("Feed Description: " + feed.Description);
            Console.WriteLine("Feed Image: " + feed.ImageUrl);
            foreach (var item in feed.Items)
            {
                Console.WriteLine(item.Title + " - " + item.Description);
            }
        }
コード例 #29
0
ファイル: HomeController.cs プロジェクト: user9035/webApiNew
        public ActionResult ViewFeed(int id)
        {
            var feed = this.repository.GetById(id);

            if (feed == null)
            {
                throw new NullReferenceException();
            }
            var parser = new FeedReader();
            var data   = parser.Read(feed.Uri);

            return(this.View(data));
        }
コード例 #30
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter feed url:");
            string url = Console.ReadLine();

            var urls = FeedReader.GetFeedUrlsFromUrl(url);

            string feedUrl;

            if (urls.Count() < 1)
            {
                feedUrl = url;
            }
            else if (urls.Count() == 1)
            {
                feedUrl = urls.First().Url;
            }
            else if (urls.Count() == 2) // if 2 urls, then its usually a feed and a comments feed, so take the first per default
            {
                feedUrl = urls.First().Url;
            }
            else
            {
                int i = 1;
                Console.WriteLine("Found multiple feed, please choose:");
                foreach (var feedurl in urls)
                {
                    Console.WriteLine($"{i++.ToString()} - {feedurl.Title} - {feedurl.Url}");
                }
                var input = Console.ReadLine();
                int index;
                if (!int.TryParse(input, out index) || index < 1 || index > urls.Count())
                {
                    Console.WriteLine("Wrong input. Press key to exit");
                    Console.ReadKey();
                    return;
                }
                feedUrl = urls.ElementAt(index).Url;
            }

            var reader = FeedReader.Read(feedUrl);

            foreach (var item in reader.Items)
            {
                Console.WriteLine(item.Title + " - " + item.Link);
            }

            Console.ReadKey();
        }