Some time ago, I went to Beijing to attend an activity ~ During the activity, a senior told me that he wrote something boring during the boring time, which could help us do some work for this activity ...... So I was thinking, in fact, I had a lot of boring time ...... So ~ Start up and implement some ideas to help you do things ......
So I thought that the demand ------- should be a mass group step based on Renren, so that I can publish some information to my friends and friends, or even step on the homepage of all friends on the holidays of the year, leave a greeting or something about balabala. Of course, if you don't want to harass your friends too much, the insite email function is also required ......
Then start ...... C # It's easy to write. There are only 4.0 platforms in the computer, so you don't have to choose ......
The process of the entire program is very simple ~ It is nothing more than simulating normal use, and then adding the appropriate loop where we need it.
Login -- "crawls to a friend's ID --" goes to a friend's homepage -- "leaves a message or
Login-"climb to a friend's ID-" insite email"
The process should not have much objection, so since it is a simulated normal use mode, everything becomes clear ......
Step 1: capture a package ~ I don't know much about the network ~ So ~ I'm not sure whether the word "packet capture" is correct or not ...... However, it is such an action. We can find out which parameter we send to, in what way, and when we log on ......
HttpWatch is a very NB tool ~ May meet my needs ~ However, required professional edition ...... Otherwise ...... Who wants to try ...... Haha
That is based on IE. Some people say that Firefox-based firebug is also very NB ~ What about chrome? Chrome is usually used, and Firefox is basically not used ......
It seems that I have run the question ~
C # The namespace that I want to use is as follows ......
Using System. Net;
Using System. Web;
HttpWebRequest and HttpWebRespone ~ Used in combination ~ Although it is relatively low-level, its usage is flexible and simple. The key is to meet our needs ~ Therefore, one of the most important design concepts of the entire boring program is fast ~ After all, there is not much boring time.
Oh, right ~ After logging on, I still need to save the cookie ......
Encapsulated into the dead CookieContainer MyCookie = new CookieContainer ();
Wait until the login succeeds ...... To determine whether the logon is successful, we can detect the changes in html <title> * </title> captured before and after logon.
The next step is to find a way to climb to a friend's ID ...... My solution is in the network region http://friend.renren.com/myfriendlistx.dow.item_5 ~ In addition, his next extended function is to export contact information of friends ...... After getHtml, use regular expression analysis ~ Get friend ID ......
I want to intercept a sentence here ~ Because the program is written in a hurry and scrawled manner, there is not much consideration ...... Store other IDs in a List <String> ~ In addition, you need to retrieve friend IDs every time you use them. In fact, they can be exported and stored locally, but I personally feel that the efficiency is not significantly improved.
Finally, we step on the homepage of every friend in a loop ~ Because it was a very silly way to crawl to the friendID, there was no processing or index directory, but simply saved it to an "array, therefore, this adds a set of start points and browsing users.
Implementation of message ...... Write more ......
Oh ~ Some problems have been encountered in the implementation of insite emails ~ Maybe Renren has done some processing ~ In the POST package, one parameter is biz ~ I tried it several times and it was really random ...... It is estimated that it is a verification class. It takes some effort to implement the mass mailing in the station ......