private void showNextAppTime() { if (selecteCounty == null || selectedShop == -1 || selectedType == null) { return; } if (selectedShop >= selecteCounty.Shops.Count) { return; } label14.Text = "enquiring the nearest booking..."; PaperDiaper paper = new PaperDiaper(this, null, null); Thread t = new Thread(paper.showNextAppTime); t.Start(); }
//big surprise!!! the official entrance is the encoding with s-jis of county's name, BUT, shop's name also works! And now I use shop's name with others' will narely do //And the response body between them are 3 lines: //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=9782391339&area1=&area2=北海道&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=9782391339&area1=&area2=旭川店&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=5637179822&area1=&area2=北海道&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=5637179822&area1=&area2=旭川店&area3=&event_open_date=201510&kmws="> //<a href="./search_shop_list.cgi?event_type=6&area1=&area2=%96k%8aC%93%b9&area3=&kmws=">戻る</a> //<a href="./search_shop_list.cgi?event_type=6&area1=&area2=%88%ae%90%ec%93X&area3=&kmws=">戻る</a> public int probe(string county, string shop) { string respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2=" + county + "&event_type=" + sizeType + "&sid=" + shop + "&kmws=", "GET", "", true, "", ref cookieContainer, false ); if (respHtml.Equals("Found")) { form1.setLogT("CardNo" + appointment.CardNo + ", first GET eccur an error!"); // return -1; } // <input type="submit" name="sbmt" value="予約" > rgx = @"<input type=""submit"" name=""sbmt"" value="""; myMatch = (new Regex(rgx)).Match(respHtml); if (!myMatch.Success) { form1.setLogT("CardNo" + appointment.CardNo + ", no available appointment."); return -5;// no available appointment } if (respHtml.Contains("eventId") && !respHtml.Contains("captcha")) { rgx = @"(?<=\[\]\,{""eventId"":)\d+?(?=\,)"; //there will be no veri code requireVeriCode = false; } else { rgx = @"(?<=予約"" >\n.+event_id"" value="")\d+?(?="")"; //there will be a veri code, and we can cheeck up with captcha //name="event_id" value="2543729870" requireVeriCode = true; } myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { eventId = myMatch.Groups[0].Value; } //one day's book in one card, for gong cheng county myMatch = myMatch.NextMatch(); while (myMatch.Success) { PaperDiaper paper = new PaperDiaper(form1, appointment, mail, county, shop , myMatch.Groups[0].Value, requireVeriCode); Thread t = new Thread(paper.multiBook); t.Start(); myMatch = myMatch.NextMatch(); } if (!respHtml.Contains("captcha"))// daiyyr { // jump to verification } else { //post eventId to get the verification code page respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2=" + county + "&event_type=" + sizeType + "&sid=" + shop + "&kmws=", false, "sbmt=%97%5C%96%F1&event_id="+eventId+"&event_type=6", ref cookieContainer, false ); //show verification code //<img src="./captcha/144445570520561.jpeg" alt="画像認証" /><br /> //http://aksale.advs.jp/cp/akachan_sale_pc/captcha/144445570520561.jpeg string cCodeGuid = ""; rgx = @"(?<=img src=""\./captcha/)\d+?(?=\.jpeg)"; myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { cCodeGuid = myMatch.Groups[0].Value; } lock (form1.pictureBox1) { if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "cardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; }); form1.textBox2.Invoke(sl); } else { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "cardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; } while (form1.textBox2.Text.Length < 5) { Thread.Sleep(30); } verificationCode = form1.textBox2.Text.Substring(0, 5); if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; }); form1.textBox2.Invoke(sl); } else { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; } }// end of lock picturebox1 //submit the veri code respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", false, "input_captcha=" + verificationCode + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType , ref cookieContainer, false ); while (respHtml.Contains("captcha")) { form1.setLogT("CardNo" + appointment.CardNo + ", 验证码错误!请重新输入"); rgx = @"(?<=img src=""\./captcha/)\d+?(?=\.jpeg)"; myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { cCodeGuid = myMatch.Groups[0].Value; } lock (form1.pictureBox1) { if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "CardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; }); form1.textBox2.Invoke(sl); } else { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "CardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; } while (form1.textBox2.Text.Length < 5) { Thread.Sleep(30); } verificationCode = form1.textBox2.Text.Substring(0, 5); if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; }); form1.textBox2.Invoke(sl); } else { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; } }// end of lock picturebox1 //submit the veri code respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", false, "input_captcha=" + verificationCode + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType, ref cookieContainer, false ); }//end of while wrong code }//end of if need vervification code //post email respHtml = Form1.weLoveYue( form1, "https://aksale.advs.jp/cp/akachan_sale_pc/mail_form.cgi" , "POST", requireVeriCode ? "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi" : ("http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi?sbmt=%97%5C%96%F1&event_id=" + eventId + "&event_type=" + sizeType) , false, "mail1=" + mail.address.Replace("@", "%40") + "&mail2=" + mail.address.Replace("@", "%40") + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType, // "mail1=15985830370%40163.com&mail2=15985830370%40163.com&sbmt=%8E%9F%82%D6&event_id=5393381489&event_type=6" ref cookieContainer, false ); //post email again respHtml = Form1.weLoveYue( form1, "https://aksale.advs.jp/cp/akachan_sale_pc/mail_confirm.cgi" , "POST", "https://aksale.advs.jp/cp/akachan_sale_pc/mail_form.cgi", false, "sbmt=%91%97%90M&mail1=" + mail.address.Replace("@", "%2540").Replace(".", "%252e") + "&mail2=" + mail.address.Replace("@", "%2540").Replace(".", "%252e") + "&event_id=" + eventId + "&event_type=" + sizeType , // sbmt=%91%97%90M&mail1=15985830370%2540163%252ecom&mail2=15985830370%2540163%252ecom&event_id=7938283049&event_type=6 ref cookieContainer, false ); if (respHtml.Contains("下記メールアドレスにメールを送信しました")) { form1.setLogT("CardNo" + appointment.CardNo+ ", step1 succeed, checking email: " + mail.address); } else { form1.setLogtRed("CardNo" + appointment.CardNo + ", appointments closed: " + mail.address); return -1; } keyURL = mail.queery("ご注文予約案内", @"https://aksale(\s|\S)+?(?=\r)"); if (keyURL == null | keyURL == "") { form1.setLogT("NULL url from email"); } setAppointment(mail.address, keyURL); return 1; }
private void autoB_Click(object sender, EventArgs e) { setLogtRed("user operation: start probing"); if (selecteCounty == null || selectedShop == -1 || selectedType == null) { this.setLogT("please choose type, county and shop"); return; } if (selectedShop >= selecteCounty.Shops.Count) { this.setLogT("invalid selected shop"); return; } if (debug) { PaperDiaper paper = new PaperDiaper( this, new Appointment ("2800048300159", "abc123456", "崔飛飛", "サイヒヒ", "090-8619-3569"), new Mail163<PaperDiaper>("*****@*****.**","dyyr7921129",this)); Thread t = new Thread(paper.startProbe); t.Start(); } else { if (Applist == null || Applist.Count < 1) { this.setLogT("please import valid appointment details!"); return; } if (Maillist == null || Maillist.Count < 1) { this.setLogT("please import valid email details!"); return; } for (int i = 0; i < Applist.Count && i < Maillist.Count; i++) { PaperDiaper paper = new PaperDiaper(this, Applist[i], Maillist[i]); Thread t = new Thread(paper.startProbe); t.Start(); } } }
//big surprise!!! the official entrance is the encoding with s-jis of county's name, BUT, shop's name also works! And now I use shop's name with others' will narely do //And the response body between them are 3 lines: //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=9782391339&area1=&area2=北海道&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=9782391339&area1=&area2=旭川店&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=5637179822&area1=&area2=北海道&area3=&event_open_date=201510&kmws="> //<a href="http://aksale.advs.jp/cp/akachan_sale_pc/search_event_detail.cgi?event_id=5637179822&area1=&area2=旭川店&area3=&event_open_date=201510&kmws="> //<a href="./search_shop_list.cgi?event_type=6&area1=&area2=%96k%8aC%93%b9&area3=&kmws=">戻る</a> //<a href="./search_shop_list.cgi?event_type=6&area1=&area2=%88%ae%90%ec%93X&area3=&kmws=">戻る</a> public int probe(string county, string shop) { string respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2=" + county + "&event_type=" + sizeType + "&sid=" + shop + "&kmws=", "GET", "", true, "", ref cookieContainer, false ); if (respHtml.Equals("Found")) { form1.setLogT("CardNo" + appointment.CardNo + ", first GET eccur an error!"); // return -1; } // <input type="submit" name="sbmt" value="予約" > rgx = @"<input type=""submit"" name=""sbmt"" value="""; myMatch = (new Regex(rgx)).Match(respHtml); if (!myMatch.Success) { form1.setLogT("CardNo" + appointment.CardNo + ", no available appointment."); return(-5);// no available appointment } if (respHtml.Contains("eventId") && !respHtml.Contains("captcha")) { rgx = @"(?<=\[\]\,{""eventId"":)\d+?(?=\,)"; //there will be no veri code requireVeriCode = false; } else { rgx = @"(?<=予約"" >\n.+event_id"" value="")\d+?(?="")"; //there will be a veri code, and we can cheeck up with captcha //name="event_id" value="2543729870" requireVeriCode = true; } myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { eventId = myMatch.Groups[0].Value; } //one day's book in one card, for gong cheng county myMatch = myMatch.NextMatch(); while (myMatch.Success) { PaperDiaper paper = new PaperDiaper(form1, appointment, mail, county, shop, myMatch.Groups[0].Value, requireVeriCode); Thread t = new Thread(paper.multiBook); t.Start(); myMatch = myMatch.NextMatch(); } if (!respHtml.Contains("captcha"))// daiyyr { // jump to verification } else { //post eventId to get the verification code page respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/search_event_list.cgi?area2=" + county + "&event_type=" + sizeType + "&sid=" + shop + "&kmws=", false, "sbmt=%97%5C%96%F1&event_id=" + eventId + "&event_type=6", ref cookieContainer, false ); //show verification code //<img src="./captcha/144445570520561.jpeg" alt="画像認証" /><br /> //http://aksale.advs.jp/cp/akachan_sale_pc/captcha/144445570520561.jpeg string cCodeGuid = ""; rgx = @"(?<=img src=""\./captcha/)\d+?(?=\.jpeg)"; myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { cCodeGuid = myMatch.Groups[0].Value; } lock (form1.pictureBox1) { if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "cardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; }); form1.textBox2.Invoke(sl); } else { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "cardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; } while (form1.textBox2.Text.Length < 5) { Thread.Sleep(30); } verificationCode = form1.textBox2.Text.Substring(0, 5); if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; }); form1.textBox2.Invoke(sl); } else { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; } }// end of lock picturebox1 //submit the veri code respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", false, "input_captcha=" + verificationCode + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType, ref cookieContainer, false ); while (respHtml.Contains("captcha")) { form1.setLogT("CardNo" + appointment.CardNo + ", 验证码错误!请重新输入"); rgx = @"(?<=img src=""\./captcha/)\d+?(?=\.jpeg)"; myMatch = (new Regex(rgx)).Match(respHtml); if (myMatch.Success) { cCodeGuid = myMatch.Groups[0].Value; } lock (form1.pictureBox1) { if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "CardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; }); form1.textBox2.Invoke(sl); } else { form1.pictureBox1.ImageLocation = @"http://aksale.advs.jp/cp/akachan_sale_pc/captcha/" + cCodeGuid + ".jpeg"; form1.textBox2.Text = ""; form1.textBox2.ReadOnly = false; form1.textBox2.Focus(); form1.label9.Text = "CardNo" + appointment.CardNo + ":请输入验证码"; form1.label9.Visible = true; } while (form1.textBox2.Text.Length < 5) { Thread.Sleep(30); } verificationCode = form1.textBox2.Text.Substring(0, 5); if (form1.textBox2.InvokeRequired) { delegate2 sl = new delegate2(delegate() { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; }); form1.textBox2.Invoke(sl); } else { form1.textBox2.ReadOnly = true; form1.label9.Visible = false; form1.pictureBox1.ImageLocation = @""; } }// end of lock picturebox1 //submit the veri code respHtml = Form1.weLoveYue( form1, "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi", "POST", "http://aksale.advs.jp/cp/akachan_sale_pc/captcha.cgi", false, "input_captcha=" + verificationCode + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType, ref cookieContainer, false ); } //end of while wrong code } //end of if need vervification code //post email respHtml = Form1.weLoveYue( form1, "https://aksale.advs.jp/cp/akachan_sale_pc/mail_form.cgi" , "POST", requireVeriCode ? "http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi" : ("http://aksale.advs.jp/cp/akachan_sale_pc/_mail.cgi?sbmt=%97%5C%96%F1&event_id=" + eventId + "&event_type=" + sizeType) , false, "mail1=" + mail.address.Replace("@", "%40") + "&mail2=" + mail.address.Replace("@", "%40") + "&sbmt=%8E%9F%82%D6&event_id=" + eventId + "&event_type=" + sizeType, // "mail1=15985830370%40163.com&mail2=15985830370%40163.com&sbmt=%8E%9F%82%D6&event_id=5393381489&event_type=6" ref cookieContainer, false ); //post email again respHtml = Form1.weLoveYue( form1, "https://aksale.advs.jp/cp/akachan_sale_pc/mail_confirm.cgi" , "POST", "https://aksale.advs.jp/cp/akachan_sale_pc/mail_form.cgi", false, "sbmt=%91%97%90M&mail1=" + mail.address.Replace("@", "%2540").Replace(".", "%252e") + "&mail2=" + mail.address.Replace("@", "%2540").Replace(".", "%252e") + "&event_id=" + eventId + "&event_type=" + sizeType, // sbmt=%91%97%90M&mail1=15985830370%2540163%252ecom&mail2=15985830370%2540163%252ecom&event_id=7938283049&event_type=6 ref cookieContainer, false ); if (respHtml.Contains("下記メールアドレスにメールを送信しました")) { form1.setLogT("CardNo" + appointment.CardNo + ", step1 succeed, checking email: " + mail.address); } else { form1.setLogtRed("CardNo" + appointment.CardNo + ", appointments closed: " + mail.address); return(-1); } keyURL = mail.queery("ご注文予約案内", @"https://aksale(\s|\S)+?(?=\r)"); if (keyURL == null | keyURL == "") { form1.setLogT("NULL url from email"); } setAppointment(mail.address, keyURL); return(1); }