-
- Description
- Analysis
- Start operation
Description
These days the class teacher has let us visit a webpage to watch the video, increase the number of visits. Each class also has the designated quota ... And after my tests, the number of likes is seen in the video for a while.
But as a computer professional, I certainly don't want to be a little bit.
So I had a bold idea.
Analysis
So I just look at the source code of the page
This line of code is pop-up and likes for a time of 18s.
What happened in 18 seconds? Keep looking.
You can see this pop-up like the parent div is class= "video_mask" and the default display box type is none, that is, not displayed.
All right, crap, not much.
Mainly look at the following
If we click on the thumb_xi div it will trigger the onlick= "OK" event.
If we click on the Thumb_buxi div it will trigger the onlick= "Nook ()" event.
View this JS code
By looking at the code discovery both methods call the Lookhandle (type) method. and is if you click on is like on the value of type=1, if you click is not like on the value of 2.
Haha it's too easy.
Keep looking down. Lookhandle (Type) method
This is not an AJAX request ...
Careful analysis:
The requested URL is as above, the request method is post, the data type is JSON,
In fact, the main thing is to look at the JSON type of data.
Code does not currently know that type knows it is 1 or 2. The next is VideoID, which is definitely the video ID we want to increase the number of visits.
After the AJAX request is sent on the server to determine whether the value of type 1 or 2 then in the server database like +1, browsing volume +1 ... As for why I say that the number of views +1 is judged here,
Because I found like number + don't like number = access number.
Then look at what happens after the Ajax request returns.
Think carefully, this is not the current user's operation is saved in the session ...
Whatever it is.
Start operation
Start our work.
Open MyEclipse, create a new project, and write it in index.jsp.
First, write a JS code to copy the AJAX request.
We revise, Lookhandle method what parameter also does not pass, define a parameter var type=1 directly below. We must have always liked it.
As for what code AH do not know what do not change. Videld must not change. The video we're going to brush.
As for the data returned by the server regardless.
Now that you're done, create a new button. The onclick event of the button is set to the method we just had. onclick= "Lookhandle".
I clicked 10 times and was tested and found to be successful. Views and likes all +10. There is a sense of accomplishment haha.
Then, I still feel tired. I have to keep the mouse point to add.
Programmers are just too lazy.
So:
Within the Lookhandle method recursively call yourself. No end condition wants to end itself close the window.
Also 1>10->100->1000 ...
Alas, I'm too timid.
If the server does not have a log that is excellent.
PS: This article is only for the purpose of learning, absolutely no. Thank you.
Java Brush video views, how much?