Exemplo n.º 1
0
        private EventFight ParseFight(HtmlNode fight, bool parseScrore)
        {
            List <HtmlNode> cells = null;

            if (parseScrore)
            {
                cells = fight.CssSelect("td")
                        .ToList();
                cells.Reverse();
            }

            var result = new EventFight()
            {
                Name = fight.CssSelect("[itemprop='name']")
                       .FirstOrDefault()
                       ?.Attributes["content"]
                       .Value,
                Image = fight.CssSelect("[itemprop='image']")
                        .FirstOrDefault()
                        ?.Attributes["content"]
                        .Value,
                Performers = fight.CssSelect("[itemprop='performer']")
                             .Select(x => ParsePerformer(x))
                             .ToList(),
                Time    = cells?[0].InnerText,
                Round   = cells?[1].InnerText,
                Method  = cells?[2].FirstChild.InnerText,
                Referee = cells?[2].LastChild.InnerText
            };

            return(result);
        }
Exemplo n.º 2
0
        private EventFight ParseMainEvent(HtmlNode mainEvent)
        {
            var resume = mainEvent
                         .ParentNode
                         .CssSelect(".footer")
                         .CssSelect(".resume")
                         .FirstOrDefault()
                         ?.CssSelect("td")
                         .ToDictionary(x => x.FirstChild.InnerText, x => x.LastChild.InnerText);

            var result = new EventFight()
            {
                Performers = mainEvent.CssSelect(".fighter")
                             .Select(x => ParseMainEventPerformer(x))
                             .ToList(),
                Method  = resume?["Method"],
                Round   = resume?["Round"],
                Time    = resume?["Time"],
                Referee = resume?["Referee"]
            };

            return(result);
        }