【待解决】关于百度贴吧post回帖的ajax方式

注:无意间室友想要刷一下tieba的经验值,就想给他写个代码,可是一直都没有解决这个问题。
关键是自己的tbs和mouse_pwd没办法解决。
测试页面用的是http://tieba.baidu.com/p/4135933166?pid=78394964543&cid=0#78394964543

<!doctype html>
<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="jq.js"></script>
</head>
<body>
    <!--there is uselessful-->
    <!--<form method="post" action="http://tieba.baidu.com/f/commit/post/add" id="testform" enctype="multipart/form-data">-->
        <!--<input name="id" value="utf-8">-->
        <!--<input name="kw" value="永夜君王">-->
        <!--<input name="fid"value="10916505">-->
        <!--<input name="tid"value="4481590213">-->
        <!--<input name="vcode_md5"value="">-->
        <!--<input name="floor_num"value="154">-->
        <!--<input name="rich_text"value="1">-->
        <!--<input name="tbs" value="46ae5da3f8e1015f1460772759">-->
        <!--<input name="content" value="每次都是十五字">-->
        <!--<input name="files"value="[]">-->
        <!--<input name="mouse_pwd" value="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">-->
        <!--<input name="mouse_pwd_t" value="1460772772475">-->
        <!--<input name="mouse_pwd_isclick"value="0">-->
        <!--<input name="__type__"value="reply">-->
    <!--</form>-->
<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>

你可能感兴趣的:(【待解决】关于百度贴吧post回帖的ajax方式)