private OpenLotteryXmlResult AnalyzeHtmlString(string html) { var r = new OpenLotteryXmlResult(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); //找到中奖号码 var red = doc.DocumentNode.SelectNodes("//li[@class='ball_red']"); var blue = doc.DocumentNode.SelectNodes("//li[@class='ball_blue']"); var winNumber = new StringBuilder(); foreach (var item in red) { winNumber.Append(item.InnerText + " "); } winNumber.Append("+ " + blue[0].InnerText); r.WinNumber = winNumber.ToString(); //本期销量和奖池滚存 var saleNodes = doc.DocumentNode.SelectNodes("//span[@class='cfont1 ']"); r.SaleAmount = saleNodes[0].InnerText; //格式333,462,942元 r.Balance = saleNodes[1].InnerText; //开奖详情 var detailNodes = doc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02'][1]//tr[@align='center']"); return(r); }
private OpenLotteryXmlResult AnalyzeHtmlString(string html) { var r = new OpenLotteryXmlResult(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); //找到中奖号码 var red = doc.DocumentNode.SelectNodes("//li[@class='ball_red']"); var blue = doc.DocumentNode.SelectNodes("//li[@class='ball_blue']"); var winNumber = new StringBuilder(); foreach (var item in red) { winNumber.Append(item.InnerText + " "); } winNumber.Append("+ " + blue[0].InnerText); r.WinNumber = winNumber.ToString(); //本期销量和奖池滚存 var saleNodes = doc.DocumentNode.SelectNodes("//span[@class='cfont1 ']"); r.SaleAmount = saleNodes[0].InnerText; //格式333,462,942元 r.Balance = saleNodes[1].InnerText; //开奖详情 var detailNodes = doc.DocumentNode.SelectNodes("//table[@class='kj_tablelist02'][1]//tr[@align='center']"); return r; }