Exemplo n.º 1
0
        public IList <Event> ParseEventsFromSite(string html)
        {
            var doc = new HtmlDocument();

            doc.LoadHtml(html);


            var matchesNode = doc.DocumentNode.SelectNodes("//div[@class='event event--results']").Single();


            var matchesDoc = new HtmlDocument();

            doc.LoadHtml(matchesNode.InnerHtml);


            var matches = doc.DocumentNode.SelectNodes("//div[@class='event__match event__match--static event__match--oneLine']")
                          .ToList();

            var events = matches.Select(matchNode => EventParser.ParseEvent(matchNode.InnerHtml)).ToList();

            return(events);
        }
Exemplo n.º 2
0
        public List <Event> Test()
        {
            driver = new ChromeDriver("./");
            js     = (IJavaScriptExecutor)driver;
            vars   = new Dictionary <string, object>();

            driver.Navigate().GoToUrl("https://www.flashscore.pl/pilka-nozna/anglia/premier-league/wyniki/");
            driver.Manage().Window.Size = new System.Drawing.Size(1235, 688);



            var html = driver.PageSource;

            driver.Close();

            // From String
            var doc = new HtmlDocument();

            doc.LoadHtml(html);


            var matchesNode = doc.DocumentNode.SelectNodes("//div[@class='event event--results']").Single();


            var matchesDoc = new HtmlDocument();

            doc.LoadHtml(matchesNode.InnerHtml);


            var matches = doc.DocumentNode.SelectNodes("//div[@class='event__match event__match--static event__match--oneLine']")
                          .ToList();

            var events = matches.Select(matchNode => EventParser.ParseEvent(matchNode.InnerHtml)).ToList();

            return(events);
        }