I know it's hard to leave and grab a hard seat to go home for the Chinese New Year...

Source: Internet
Author: User

It's really embarrassing. I can see how many of my friends on the Internet use their own tools and scripts to buy a home ticket, at least they are still in a sleeper. But I can't do it, I only bought a hard-seat ticket (I have completed the payment and received a text message of 12306, but I have not changed my paper ticket ). Since I only bought a hard seat, what else can I say? What's more, this is the blog home page! In fact, I just want to say that I have actually done a lot of work, it may be that the technology is not good, it may be a lot of detours, or it may be that although 12306 or 95105105 is bad, they are constantly improving, the method found today may be ineffective tomorrow.

First, let's talk about what we have done:

12306. cn

After I visited the website for the first time, I thought I could write an automated tool to automatically check my tickets and book tickets. In the first step, we thought that the previous steps were manually implemented, and then we constructed and sent the final ticket booking data. To simulate submission. However, it is not ideal. Although all the cookie information on the local device is simulated and submitted, the correct ticket booking information cannot be returned.

So I wanted to write tools like WinForm and encountered a verification code. I have considered using artificial methods, but I still think it would be better if I could crack the graphic verification code. Instead, it took one or two days to get the Verification Code. For example, we changed the image information to a matrix of 0 and 1, and identified it by finding the relative location, but the recognition effect is not good, so give up.

In the last two days, I have not considered writing any more tools on the website. I have registered three accounts and added all the people I want to buy as contacts, when checking the ticket, you can mount the following simple script to automatically refresh it.

SetInterval ("this.document.getelementbyid('main'{.content}doc ument. getElementById ('submitquery'). click ();", 10000)

 

95105105

Although the telephone ticket booking channel knows the time is a little later than online, but I read some articles online, it seems that the success rate of ticket booking by phone is high. At the beginning, I realized it automatically, but I added a verification code during the ticket booking process. The automation of the entire process is not feasible for the time being. However, since I have been familiar with Skype-related APIs before, I wrote a Simple plug-in for automated redial and ID card input functions. During this plug-in process, I also decided to purchase the skype package for more than 800 minutes (half of it was not used up ).

Skype call recording and redial code as soon as possible (Skype4COM needs to be installed)

View Code // <summary>
/// Busy redial
/// </Summary>
/// <Param name = "phoneNum"> phone number, such as 01095105105 </param>
Public void ReDial (string phoneNum)
{
Try
{
ObjSkpe = new Skype ();
ObjSkpe. Attach (7, true );

ObjCall = objSkpe. PlaceCall (phoneNum );
// Set the audio file output directory
String outPutFolder = System. Environment. CurrentDirectory + "\ audio \\";
If (! Directory. Exists (outPutFolder ))
{
Directory. CreateDirectory (outPutFolder );
}
String waveFile = outPutFolder + phoneNum + "_" + DateTime. Now. ToString ("yyyyMMdd_hhmmss") + ". wav ";
// Recording
ObjCall. set_OutputDevice (TCallIoDeviceType. callIoDeviceTypeFile, waveFile );

// WriteLog ("dialing ...");
TimeSpan startTime = new TimeSpan (DateTime. Now. Ticks );
// Loop until the call is in progress
While (objCall. Status! = TCallStatus. clsInProgress)
{
// Determine the dialing timeout
If (objCall. Status = TCallStatus. clsRouting)
{
Thread. Sleep (1000 );
TimeSpan stopTime = new TimeSpan (DateTime. Now. Ticks );
TimeSpan val = stopTime. Subtract (startTime). Duration ();

If (val. TotalSeconds> 30)
{
ObjCall. Finish ();
}
Continue;

}
// Busy or closed Replay
If (objCall. Status = TCallStatus. clsBusy
| ObjCall. Status = TCallStatus. clsFailed
| ObjCall. Status = SKYPE4COMLib. TCallStatus. clsFinished
| ObjCall. Status = SKYPE4COMLib. TCallStatus. clsCancelled
| ObjCall. Status = SKYPE4COMLib. TCallStatus. clsEarlyMedia
| ObjCall. Status = SKYPE4COMLib. TCallStatus. clsRinging
)
{
// If it is a busy voice, you need to stop and then redial
If (objCall. Status = SKYPE4COMLib. TCallStatus. clsEarlyMedia | objCall. Status = SKYPE4COMLib. TCallStatus. clsRinging)
{
ObjCall. Finish ();
}
// WriteLog ("busy redial ...");
Thread. Sleep (1000 );
ReDial (phoneNum );
}
}

// WriteLog ("in call ...");
}
Catch (Exception exp)
{
// WriteLog ("Error:" + exp. Message );
}
}

 

Although the process automation system is difficult to implement, I have made some efforts in this regard. For example, I used Microsoft's SpeechSDK to participate in my ticket grabbing work, the following is the result of calling the SppechSDK to recognize the voice to text.

However, no progress has been made in this solution because Skype has not been directly transferred to a stream that can be identified by the SpeechSDK.

 

Effect:

12306. in fact, the hard seat actually written tools referred to in the title of this cn article are not useful, and are finally set by "Manual, unfortunately, no less than 50 sleeper orders were submitted, but the orders could not be successfully booked.

95105105 many features have been developed, but the most practical one is automatic replay. This channel helped a friend buy a sleeper for a guest yesterday (January 18), which is also a consolation. I wanted to order a ticket for myself today, but it was quite difficult for me to get two Skype tickets from to. I confirmed the ticket booking information several times. The system gave me a prompt saying, "The system is busy, please press 1 for ticket booking. The ticket crashed .... (If you do not dial a number earlier than, you may not be able to book a ticket for the latest pre-sale period from to. The website also seems to have this problem. It is determined based on the logon time rather than the current time, so it is useless to set an early dial .)

Summary:

In fact, I have made some explorations in both the website and telephone directions, but basically all of them are useless. I think this is a programmer's ticket grabbing operation. I think there are the following points that need to be considered:

1. Development work is out of target

Although the goal is clear, it is easy to go into a dead end in the actual development process, especially if the technical problem is solved with a sense of accomplishment. Of course, it may be because of the limited technical level that some experts have already solved these problems.

2. There are too few items, too many items are prepared, and the ticket is in disorder. View my workbench snapshots

 

No matter what. I think this ticket snatching is much more interesting than buying tickets at the station. Finally,Happy New Year!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.