// BoxScore 정보 얻기 public DbItemBase GetBoxScore(Schedule schedule) { Int32 errorCount = 0; while (true) { try { chromeDriver = InitCromeDriver(); CrawlerBoxScore crawler = new CrawlerBoxScore(chromeDriver); crawler.Init(schedule); String html = crawler.GetHTML(); DbItemBase boxScore = ParserBoxScore_W.Instance.Parse(schedule, html); return(boxScore); } catch (Exception) { errorCount++; if (errorCount > 5) { return(null); } } } }
// Player정보 얻기 public DbItemBase GetPlayer(Player_W player_W) { Int32 errorCount = 0; while (true) { try { chromeDriver = 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]); DbItemBase player = ParserPlayer.Instance.Parse(html, player_W.Team, playerId); return(player); } catch (Exception e) { errorCount++; if (errorCount > 5) { throw e; } } } }
// Situation 정보 얻기 public DbItemBase GetSituation(Schedule schedule) { Int32 errorCount = 0; while (true) { try { List <DbItemBase> schedules = new List <DbItemBase>(); chromeDriver = InitCromeDriver(); CrawlerSituation crawler = new CrawlerSituation(chromeDriver); crawler.Init(schedule); String html = crawler.GetHTML(); DbItemBase situation = ParserSituation_W.Instance.Parse(schedule, html); return(situation); } catch (Exception) { errorCount++; if (errorCount > 5) { return(null); } } } }