document.getElementById("article_content").outerHTML;
在任意的一片博文运行以上代码都可以获得正文内容,但是对于代码、字体都没有渲染,甚是难看。
提取出来的博客关键代码:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="http://static.blog.csdn.net/scripts/jquery.js" type="text/javascript"></script> <link rel="Stylesheet" type="text/css" href="http://static.blog.csdn.net/skin/skin-blue/css/style.css?v=1.1" /> <link rel="shortcut icon" href="http://c.csdnimg.cn/public/favicon.ico" /> <link type="text/css" rel="stylesheet" href="http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css" /> </head> <body> <div id="container"> <script type="text/javascript"> var username = "x_iya"; var _blogger = username; var blog_address = "http://blog.csdn.net/x_iya"; var static_host = "http://static.blog.csdn.net"; var currentUserName = ""; </script> <div id="body"> <div id="main"> <div class="main"> <div id="article_details" class="details"> <script type="text/javascript"> document.getElementById("article_content").outerHTML; </script> </div> </div> </div> <script type="text/javascript" src="http://static.blog.csdn.net/scripts/newblog.min.js"></script> </div> </body> </html>把正文的div写在<div id="article_details" class="details">here</div>中就可以达到博文的效果了。
js代码:
javascript:document.write("<html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <script src='http://static.blog.csdn.net/scripts/jquery.js' type='text/javascript'></script> <link rel='Stylesheet' type='text/css' href='http://static.blog.csdn.net/skin/skin-blue/css/style.css?v=1.1' /> <link rel='shortcut icon' href='http://c.csdnimg.cn/public/favicon.ico' /> <link type='text/css' rel='stylesheet' href='http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/default.css' /> </head> <body> <div id='container'> <script type='text/javascript'> var username = 'x_iya'; var _blogger = username; var blog_address = 'http://blog.csdn.net/x_iya'; var static_host = 'http://static.blog.csdn.net'; var currentUserName = ''; </script> <div id='body'> <div id='main'> <div class='main'> <div id='article_details' class='details'>", document.getElementById("article_content").outerHTML, "</div> </div> </div> <script type='text/javascript' src='http://static.blog.csdn.net/scripts/newblog.min.js'></script> </div> </body> </html>");
在地址栏输入以上JS代码或者在chrome新建一个网页
点击下就可以获得了。