抓取不到新浪微博的网页
以下是page.tostring(),可是查看浏览器源码差太多了
Page{request=Request{url='http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3', method='null', extras={statusCode=200}, priority=0}, resultItems=ResultItems{fields={content=null}, request=Request{url='http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3', method='null', extras={statusCode=200}, priority=0}, skip=false}, rawText='<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312"/>
<title>Sina Visitor System</title>
</head>
<body>
<span id="message"></span>
<script type="text/javascript" src="/js/visitor/mini.js"></script>
<script type="text/javascript">
window.use_fp = "1" == "1"; // 是否采集设备指纹。
var url = url || {};
(function () {
this.l = function (u, c) {
try {
var s = document.createElement("script");
s.type = "text/javascript";
s[document.all ? "onreadystatechange" : "onload"] = function () {
if (document.all && this.readyState != "loaded" && this.readyState != "complete") {
return
}
this[document.all ? "onreadystatechange" : "onload"] = null;
this.parentNode.removeChild(this);
if (c) {
c()
}
};
s.src = u;
document.getElementsByTagName("head")[0].appendChild(s)
} catch (e) {
}
};
}).call(url);
// 流程入口。
wload(function () {
try {
var need_restore = "1" == "1"; // 是否走恢复身份流程。
// 如果需要走恢复身份流程,尝试从 cookie 获取用户身份。
if (!need_restore || !Store.CookieHelper.get("SRF")) {
// 若获取失败走创建访客流程。
// 流程执行时间过长(超过 3s),则认为出错。
var error_timeout = window.setTimeout("error_back()", 3000);
tid.get(function (tid, where, confidence) {
// 取指纹顺利完成,清除出错 timeout 。
window.clearTimeout(error_timeout);
incarnate(tid, where, confidence);
});
} else {
// 用户身份存在,尝试恢复用户身份。
restore();
}
} catch (e) {
// 出错。
error_back();
}
});
// “返回” 回调函数。
var return_back = function (response) {
if (response["retcode"] == 20000000) {
back();
} else {
// 出错。
error_back(response["msg"]);
}
};
// 跳转回初始地址。
var back = function() {
var url = "http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3";
if (url != "none") {
window.location.href = url;
}
};
// 跨域广播。
var cross_domain = function (response) {
var from = "weibo";
if (response["retcode"] == 20000000) {
var crossdomain_host = "login.sina.com.cn";
if (crossdomain_host != "none") {
var cross_domain_intr = window.location.protocol + "//" + crossdomain_host + "/visitor/visitor?a=crossdomain&cb=return_back&s=" +
encodeURIComponent(response["data"]["sub"]) + "&sp=" + encodeURIComponent(response["data"]["subp"]) + "&from=" + from + "&_rand=" + Math.random();
url.l(cross_domain_intr);
} else {
back();
}
} else {
// 出错。
error_back(response["msg"]);
}
};
// 为用户赋予访客身份 。
var incarnate = function (tid, where, conficence) {
var gen_conf = "";
var from = "weibo";
var incarnate_intr = window.location.protocol + "//" + window.location.host + "/visitor/visitor?a=incarnate&t=" +
encodeURIComponent(tid) + "&w=" + encodeURIComponent(where) + "&c=" + encodeURIComponent(conficence) +
"&gc=" + encodeURIComponent(gen_conf) + "&cb=cross_domain&from=" + from + "&_rand=" + Math.random();
url.l(incarnate_intr);
};
// 恢复用户丢失的身份。
var restore = function () {
var from = "weibo";
var restore_intr = window.location.protocol + "//" + window.location.host +
"/visitor/visitor?a=restore&cb=restore_back&from=" + from + "&_rand=" + Math.random();
url.l(restore_intr);
};
// 跨域恢复丢失的身份。
var restore_back = function (response) {
// 身份恢复成功走广播流程,否则走创建访客流程。
if (response["retcode"] == 20000000) {
var url = "http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3";
var alt = response["data"]["alt"];
var savestate = response["data"]["savestate"];
if (alt != "" && url != "none") {
var params = "entry=sso&alt=" + encodeURIComponent(alt) + "&returntype=META&url=" + encodeURIComponent(url) +
"&gateway=1&savestate=" + encodeURIComponent(savestate);
window.location.href = "http://login.sina.com.cn/sso/login.php?" + params;
} else {
cross_domain(response);
}
} else {
tid.get(function (tid, where, confidence) {
incarnate(tid, where, confidence);
});
}
};
// 出错情况返回登录页。
var error_back = function (msg) {
var url = "http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3";
if (url != "none") {
if (url.indexOf("ssovie4c55=0") === -1) {
url += (((url.indexOf("?") === -1) ? "?" : "&") + "ssovie4c55=0");
}
window.location.href = "http://weibo.com/login.php";
} else {
if(document.getElementById("message")) {
document.getElementById("message").innerHTML = "Error occurred" + (msg ? (": " + msg) : ".");
}
}
}
</script>
</body>
</html>', url=http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3, statusCode=200, targetRequests=[]}
get page: http://weibo.com/rjfittime?from=feed&loc=at&nick=FitTime%E7%9D%BF%E5%81%A5%E6%97%B6%E4%BB%A3
content: null
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
说明页面是用js产生的