注:无意间室友想要刷一下tieba的经验值,就想给他写个代码,可是一直都没有解决这个问题。
关键是自己的tbs和mouse_pwd没办法解决。
测试页面用的是http://tieba.baidu.com/p/4135933166?pid=78394964543&cid=0#78394964543
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jq.js">script>
head>
<body>
<script>
var data = {
ie:"utf-8",
kw:encodeURIComponent("大学生励志"), //tieba name
fid:"1847502", //tieba id
tid:"4135933166", //thread id
vcode_md5:"",
floor_num:"36", //floor num
rich_text:"1",
tbs:"b19e260a5ba77b8e1460976402", //maybe a random num
content:encodeURIComponent("每次都不行"),
files:encodeURIComponent("[]"),
mouse_pwd:encodeURIComponent("127,126,115,103,122,127,121,126,127,66,122,103,123,103,122,103,123,103,122,103,123,103,122,103,123,103,122,103,123,66,126,126,125,121,66,122,120,125,125,103,124,125,115,14607727724750"), // maybe some random num
mouse_pwd_t: new Date().getTime().toString(), //maybe time
mouse_pwd_isclick:"0",
__type__:"reply"
}
data = (function(obj){
var str = "";
for(var pro in obj) {
str += pro+"="+obj[pro]+"&";
}
return str;
})(data);
jQuery.support.cors = true;
$.ajax({
url: "http://tieba.baidu.com/f/commit/post/add",
type: "post",
data: data,
// beforeSend: function (request) {
// request.setRequestHeader("Cookie", document.cookie);
// },
success: function (data) {
alert("1:" + data.toString())
var tmp = eval(data);
alert(tmp.no)
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
}
});
script>
body>
html>