Ejemplo n.º 1
0
        // Player 정보 얻기
        public Player GetPlayer(Player_W player_W)
        {
            InitCromeDriver();
            CrawlerPlayer crawler = new CrawlerPlayer(chromeDriver);
            crawler.Init(player_W.Href);

            String html = crawler.GetHTML();

            String[] items = player_W.Href.Split(new String[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
            Int32 playerId = Convert.ToInt32(items[items.Length - 1]);
            var player = Parser.ParserPlayer.Instance.Parse(html, player_W.Team, playerId);
            return player;
        }
Ejemplo n.º 2
0
        public List<Player_W> Parse(String html, String team)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(html);
            var nodes = doc.DocumentNode.SelectNodes("//tr");
            List<Player_W> players = new List<Player_W>();
            foreach (var node in nodes)
            {
                var items = node.SelectNodes("td");

                Player_W player = new Player_W
                {
                    Href = items[1].SelectSingleNode("a").GetAttributeValue("href", ""),
                    Team = team
                };
                players.Add(player);
            }

            return players;
        }