post方式发微博

使用post方式实现微博的发送
request和post需要用到的参数如下:

rnd:当前时间减去1970.01.01,时间差转换为毫秒
mid:微博id
uid:当前登录的用户id
cid:当前评论id
ouid:当前评论内容的博主用户id
status_owner_user:不清楚,随便一个值就可以
retcode:验证码正确返回的retcode内容
ts:发送验证码需要的参数
一.    评论
1.    RequestUrl:请求链接
http://weibo.com/aj/comment/add?_wv=5&__rnd=1359019829989

2.    post参数:
act=post&mid=3488868806295235&uid=1790097785&forward=0&isroot=0&content=哇,好漂亮&type=big&location=mblog&module=bcommlist&_t=0

评论成功返回内容:
{"code":"100000","msg":"","data":{"comment":"<dl class="comment_list S_line1"  mid="3488868806295235"><dt><a href="/xuejiangtao927" title="Jesus_爱的大能"><img src="http://tp4.sinaimg.cn/2266282115/50/5606455045/1" width="30" height="30" alt="" /></a></dt><dd><a href="/xuejiangtao927" title="Jesus_爱的大能">Jesus_爱的大能</a>:哇,好漂亮<span class="S_txt2">(10秒前)</span><div class="info"><em class="hover"><a href="javascript:void(0);" action-type="delComment" action-data="cid=3538048014462317&block=0">删除</a><i class="S_txt3">|</i></em><a href="javascript:void(0);" action-data="ouid=2266282115&cid=3538048014462317&mid=3488868806295235&content=Jesus_爱的大能&type=big&status_owner_user=1790097785" action-type="replycomment">回复</a></div><div class="WB_media_expand repeat S_line1 S_bg4" node-type="commentwrap" style="display:none;"><div class="arrow W_bgcolor_arrow"></div><div class="S_line1 input clearfix"><textarea action-type="check" node-type="textEl" name="" rows="" cols=""></textarea><div class="action"><span class="W_ico16 ico_faces" node-type="smileyBtn"></span><ul class="commoned_list" node-type="widget"><li><label><input type="checkbox" name="" node-type="forward" class="W_checkbox" />同时转发到我的微博</label></li></ul></div><p class="btn"><a href="javascript:void(0);" class="W_btn_b btn_noloading" action-type="doReply"><span><b class="loading"></b><em node-type="btnText">评论</em></span></a></p></div></div></dd></dl>","feed":"","content":""}}

二.    转发
1.    RequestUrl:请求链接
http://weibo.com/aj/mblog/forward?_wv=5&__rnd=1359013546225

2.    post参数:
appkey=&mid=3488868806295235&style_type=2&mark=&reason=转发内容(不写默认为“转发微博”)&rank=0&rankid=&location=mblog&_t=0

转发成功返回内容:
 {"code":"100000","msg":"","data":{"html":"<dl class="comment_list S_line1 clearfix WB_feed_type " mid="3538053735807779"><dt><a href="/xuejiangtao927" title=""><img src="http://tp4.sinaimg.cn/2266282115/50/5606455045/1" width="30" height="30" usercard="id=2266282115"  alt="Jesus_爱的大能" /></a></dt><dd><a href="/xuejiangtao927" title="Jesus_爱的大能" nick-name="Jesus_爱的大能" usercard="id=2266282115">Jesus_爱的大能</a>:<em>不错000</em><span class="S_txt2">(10秒前)</span><div class="info"><em class="hover"><a href="javascript:void(0);" action-data="mid=3538053735807779" action-type="feed_list_delete">删除</a><i class="S_txt3">|</i></em><a href="javascript:void(0);" action-type="feed_list_forward" onclick="return false;">转发</a></div></dd></dl>"}}
 
三.    回复(两种情况)
在微博评论下回复
1.    RequestUrl:请求链接    
http://weibo.com/aj/comment/add?_wv=5&__rnd=1359014438680
 
2.    post参数:
act=reply&mid=3537963134710637&cid=3538055069944409&uid=2266282115&forward=0&isroot=0&content=回复内容&type=big&ouid=1189801740&ispower=1&status_owner_user=1400111812&_t=0&location=mblog

回复成功返回内容:
{"code":"100000","msg":"","data":{"comment":"<dl class="comment_list S_line1"  mid="3537963134710637"><dt><a href="/xuejiangtao927" title="Jesus_爱的大能"><img src="http://tp4.sinaimg.cn/2266282115/50/5606455045/1" width="30" height="30" alt="" /></a></dt><dd><a href="/xuejiangtao927" title="Jesus_爱的大能">Jesus_爱的大能</a>:不是吧<span class="S_txt2">(10秒前)</span><div class="info"><em class="hover"><a href="javascript:void(0);" action-type="delComment" action-data="cid=3538057938371936&block=0">删除</a><i class="S_txt3">|</i></em><a href="javascript:void(0);" action-data="cid=3538057938371936&is_more=1&type=big&ouid=1400111812" action-type="commentDialogue" suda-data="key=comment&value=big_comment_dialog" class="">查看对话</a><i class="S_txt3">|</i><a href="javascript:void(0);" action-data="ouid=2266282115&cid=3538057938371936&mid=3537963134710637&content=Jesus_爱的大能&type=big&status_owner_user=1400111812" action-type="replycomment">回复</a></div><div class="WB_media_expand repeat S_line1 S_bg4" node-type="commentwrap" style="display:none;"><div class="arrow W_bgcolor_arrow"></div><div class="S_line1 input clearfix"><textarea action-type="check" node-type="textEl" name="" rows="" cols=""></textarea><div class="action"><span class="W_ico16 ico_faces" node-type="smileyBtn"></span><ul class="commoned_list" node-type="widget"><li><label><input type="checkbox" name="" node-type="forward" class="W_checkbox" />同时转发到我的微博</label></li></ul></div><p class="btn"><a href="javascript:void(0);" class="W_btn_b btn_noloading" action-type="doReply"><span><b class="loading"></b><em node-type="btnText">评论</em></span></a></p></div></div></dd></dl>","feed":"","content":""}}

在收到的评论下回复
1.    RequestUrl:请求链接    
http://weibo.com/aj/comment/add?_wv=5&__rnd=1359014438680

2.    post参数:
act=reply&mid=3489105885446542&cid=3538027206922737&uid=2266282115&forward=0&isroot=0&content=回复内容&ouid=2896542787&ispower=1&status_owner_user=1455195534&_t=0&location=commbox

回复成功:
{"code":"100000","msg":"","data":{"comment":"<dl class="comment_list S_line1"  mid="3489105885446542"><dt><a href="/xuejiangtao927" title="Jesus_爱的大能"><img src="http://tp4.sinaimg.cn/2266282115/50/5606455045/1" width="30" height="30" alt="" /></a></dt><dd><a href="/xuejiangtao927" title="Jesus_爱的大能">Jesus_爱的大能</a>:也祝你们生活工作愉快<span class="S_txt2">(10秒前)</span><div class="info"><em class="hover"><a href="javascript:void(0);" action-type="delComment" action-data="cid=3538062527107420&block=0">删除</a><i class="S_txt3">|</i></em><a href="javascript:void(0);" action-data="cid=3538062527107420&is_more=1&type=big&ouid=1455195534" action-type="commentDialogue" suda-data="key=comment&value=big_comment_dialog" class="">查看对话</a><i class="S_txt3">|</i><a href="javascript:void(0);" action-data="ouid=2266282115&cid=3538062527107420&mid=3489105885446542&content=Jesus_爱的大能&type=big&status_owner_user=1455195534" action-type="replycomment">回复</a></div><div class="WB_media_expand repeat S_line1 S_bg4" node-type="commentwrap" style="display:none;"><div class="arrow W_bgcolor_arrow"></div><div class="S_line1 input clearfix"><textarea action-type="check" node-type="textEl" name="" rows="" cols=""></textarea><div class="action"><span class="W_ico16 ico_faces" node-type="smileyBtn"></span><ul class="commoned_list" node-type="widget"><li><label><input type="checkbox" name="" node-type="forward" class="W_checkbox" />同时转发到我的微博</label></li></ul></div><p class="btn"><a href="javascript:void(0);" class="W_btn_b btn_noloading" action-type="doReply"><span><b class="loading"></b><em node-type="btnText">评论</em></span></a></p></div></div></dd></dl>","feed":"","content":""}}

四.    私信:
没有验证码
1.    RequestUrl:请求链接    
http://weibo.com/aj/message/add?_wv=5&__rnd=1359024182224

2.    post参数:
text=私信内容&screen_name=对方昵称&id=0&fids=&touid=0&style_id=2&location=msglist&module=msglayout&_t=0


私信成功返回内容:
{"code":"100000","msg":"恭喜,操作成功啦^_^","data":{"uid":"2247272127","html":"<div class="check_operation clearfix"><div class="private_check" style="display:none;" name="msgList[]" value="2247272127" id="msgCheckboxInput_2247272127" action-type="msgCheckBox" node-type="msgCheckBox">             <input type="checkbox" class="W_checkbox"></div><dl class="private_list clearfix" node-type="messageUnit" uid="2247272127">                <dd class="close" action-type="delMessage" action-data="uid=2247272127&userName=fastw"><a class="hover W_ico12 icon_close" href="javascript:void(0);"></a></dd>                <dt class="face"><a href="/u/2247272127" class="im_status"><img alt="fastw?>"  usercard="id=2247272127" src="http://tp4.sinaimg.cn/2247272127/50/0/1" width="50" height="50"></a></dt>                <dd class="content">                  <p class="content_txt">发给 <a class="user_name S_func1" title="fastw" href="/u/2247272127" usercard="id=2247272127" suda-uatrack="key=tblog_messages_behavior&value=contact_name">fastw(王雪飞)</a> :hello,boy</p>                  <!-- 附件区 -->                                    <!-- /附件区 -->                  <p class="info S_txt2">                   <span>                   <em class="hover">                                    <a suda-data="key=message_all_forward_page&amp;value=message_all_forward_page" href="javascript:void(0);" action-type="forwardMessage" action-data="mid=3538067334275797&is_send=1?>&allowForward=">转发</a>                  <i class="W_vline">|</i>                  </em>                   <a node-type="messageDetail" href="/message/history?uid=2247272127">共7条私信</a>                   <i class="W_vline">|</i>                  <a suda-uatrack="key=tblog_messages_behavior&value=quick_reply" suda-data="key=message_messagelist_reply_page&value=message_messagelist_reply_page" href="javascript:void(0);" action-type="replyMessage" action-data="userName=fastw">快速回复</a>                   </span>                   <i class="date">10秒前</i>                   </p>                </dd>              </dl>              </div>"}}

私信验证码:
有验证码的内容:
{"code":"100027","msg":"(100027)","data":null}

限制发私信:
{"code":"100001","msg":"抱歉,根据用户设置,你暂时不能给他发送私信哦。(20301)","data":null}

发送错误:
{\"code\":\"100001\",\"msg\":\"该昵称目前不存在,请确认昵称重新输入哦。(20003)\",\"data\":null}

获取验证码
1.    Request获取验证码图片
RequestUrl:
http://weibo.com/aj/pincode/pin?type=rule&lang=zh-cn&ts=135908325420233
获取图片并打码

2.    验证码post出去返回retcode
RequestUrl: http://weibo.com/aj/pincode/verified?_wv=5&__rnd=1359095904120

post参数:secode=验证码&type=rule&_t=0

3.    验证码验证成功返回内容:
{"code":"100000","msg":"","data":{"retcode":"dd596b8ee7675f6eb82d2915ca14ffaf"}}
提取retcode中的内容

再次发送私信
1.    RequestUrl:请求链接    
http://weibo.com/aj/message/add?_wv=5&__rnd=1359024182224

2.    post参数:将验证码返回的retcode,追加到发送私信post参数的末尾

text=私信内容&screen_name=对方昵称&id=0&fids=&touid=0&style_id=2&location=msglist&module=msglayout&_t=0&retcode=验证码返回的retcode内容
    

 

posted on 2013-02-04 00:25  雨渐渐  阅读(2514)  评论(2编辑  收藏  举报

导航