First enter the http://m.fanfou.com to log on to your account. then press F12 in chrome to switch to the last bar & quot; Console & quot ;. paste the following code and press Enter: varbodydocument. getElementsByTagName (& amp; #39; body & amp; #39;) [0]; varsdocum
First enter the http://m.fanfou.com to log on to your account.
Then press F12 in chrome to switch to the "Console" in the last column ".
Paste the following code and press Enter:
Var body = document. getElementsByTagName ('body') [0];
Var s = document. createElement ('script ');
S. setAttribute ('type', 'text/javascript ');
S. setAttribute ('src', 'HTTP: // ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js ');
Body. appendChild (s );
Then modify the following code to remove the comment before the backup.
// Add to favorites
// Var next_url = "/favorites"; var type = "fav ";
// @ My
// Var next_url = "/mentions"; var type = "";
// Received private message
// Var next_url = "/privatemsg"; var type = "pri ";
// Private Message
// Var next_url = "/privatemsg/sent"; var type = "pri ";
// Personal message
// Var next_url = "/user name in the Link"; var type = "usr ";
Var count = 0;
Var src = [];
Function save_log (){
If (typeof (next_url )! = "Undefined" & next_url! = Null ){
$. Get ("http://m.fanfou.com" + next_url, function (data ){
$ ("Html" ).html (data );
If (type = "fav "){
Var p1 = $ ("h2"). next ("p ");
} Else {
Var p1 = $ ("h2"). next ("p ");
}
While (p1.html ()! = Null & p1.next ("p" ).html ()! = Null ){
Src. push ("
"++ Count +" "+ p1.html () +"
\ N ");
Console. log ("
"+ Count +" "+ p1.html () +"
\ N ");
P1 = p1.next ("p ");
}
Next_url = p1.find ("a: contains ('Next page')"). attr ("href ");
Save_log ();
});
} Else {
Var str = src. join ("");
Document. write (str );
Console. log ("backup completed. Press ctrl + s to save this page .");
Alert ("backup completed. Press ctrl + s to save this page .");
}
}
Console. log (" ");
Src. push ("");
Save_log ();
Paste the above Code that cancels a comment in "Console" and press Enter.
Then let's wait for the results. After all the results are captured, they will be displayed on the webpage. Press Ctrl + S to save them.
This script does not consider performance optimization issues, and may be stuck when there is too much data. Please wait ..
If the backup result is not displayed on the page, copy the output content in the console and save it to the html file.
You are welcome to provide suggestions on performance issues in the comments ..
Record Several optimization points
One is a large String, which continuously causes performance problems for the String type + =.
Later, I used arrays, pushed strings one by one, and joined () to form a large string, which is more efficient.
The second is when the $ ("html" character .html (src) parameter is a very large string,
The browser occupies 100% of the CPU and the page is completely stuck and cannot be recovered.
Later, we switched to document. write (str), which greatly improved the page rewriting speed.