コード例 #1
0
ファイル: Form1.cs プロジェクト: palasa/FuckWZJ
 /// <summary>
 /// 获取每张票务的详情
 /// </summary>
 private void GetTicketsDetail()
 {
     foreach (var live in allLives)
     {
         // Task.Factory.StartNew ( ()=>
         live.LiveDetail = LiveUtil.GetLiveDetailByLiveId(live.TicketNumber);
         // );
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: palasa/FuckWZJ
        /// <summary>
        /// // 获取可购票务列表 , 包括票务基本信息
        /// </summary>
        private void GetTickets()
        {
            // 打开票务页面
            // https://shop.48.cn/tickets

            // 查找每一个 <li class="gs_2t"><a title="星梦剧院11月11日NIII队剧场公演" href="/tickets/item/2607">广州星梦剧院11月11日NIII队剧场公演</a></li>
            var allTicketPageString = util.GET("https://shop.48.cn/tickets", cc);

            allTicketPageString = allTicketPageString.Replace("\\", "");
            Regex           regexp           = new Regex("<li class=\"gs_2t\">.{20,100}</a></li>");
            MatchCollection matchCollection1 = regexp.Matches(allTicketPageString);

            // 获取票务基本信息
            foreach (var item in matchCollection1)
            {
                // item : <li class="gs_2t"><a title="星梦剧院11月11日NIII队剧场公演" href="/tickets/item/2607" title="....">广州星梦剧院11月11日NIII队剧场公演</a></li>
                string liString = item.ToString();
                int    num1     = liString.IndexOf("剧院");
                int    num2     = liString.IndexOf("月");
                int    num3     = liString.IndexOf("日");
                int    num4     = liString.IndexOf("公演");

                int num5 = liString.LastIndexOf("\">");
                int num6 = liString.LastIndexOf("星梦剧院");

                int num7 = liString.LastIndexOf("item/");
                int num8 = liString.LastIndexOf("title=");

                string city  = liString.Substring(num5 + 2, num6 - num5 - 2);        // 沈阳
                string month = liString.Substring(num1 + 2, num2 - num1 - 2);        // 11
                string day   = liString.Substring(num2 + 1, num3 - num2 - 1);        // 10
                string team  = liString.Substring(num3 + 1, num4 - num3 - 1);;       // SIII队 / 预备生
                team = team.Replace("剧场", "");
                string ticketNumber = liString.Substring(num7 + 5, num8 - num7 - 7); // 2607

                Live live = LiveUtil.GetLive(city, month, day, team, ticketNumber);

                allLives.Add(live);
            }
        }