最新新浪微博发布分析 发布接口(支持图片)
本帖最后由 zhouchanglin 于 2014-5-14 09:35 编辑发布分析:
抓包如下:
1.上传一张本地图片
请求头:
POST http://picupload.service.weibo.com/interface/pic_upload.php?cb=http%3A%2F%2Fweibo.com%2Faj%2Fstatic%2Fupimgback.html%3Fcallback%3DSTK_ijax_1358560285851117&url=weibo.com%2Fchoumeijj&markpos=1&logo=1&nick=%40%E8%87%AD%E7%BE%8E%E5%9C%88ya&marks=1&app=miniblog&s=rdxt HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Content-Type: multipart/form-data; boundary=---------------------------7dd6f111049a
Accept-Encoding: gzip, deflate
Host: picupload.service.weibo.com
Content-Length: 5082
-----------------------------7dd6f111049a
Content-Disposition: form-data; name="pic1"; filename="[文件名:本地图片]"
Content-Type: image/jpeg
[文件源码:本地图片]
-----------------------------7dd6f111049a--
响应头:
HTTP/1.1 302 Found
Date: Sat, 19 Jan 2013 02:02:12 GMT
Server: Apache
X-Powered-By: PHP/5.2.14
P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Location: http://weibo.com/aj/static/upimgback.html?callback=STK_ijax_1358560285851117&ret=1&pid=67351401tw1e0yn91vtjhj&token=GhlEjF6q%2BRkRKUyXDZW3abnmqacJH%2Fpz6ZJOAE%2FD2Yk%3D&path=gLbth51b6V0%3D
Content-Length: 0
Connection: close
Content-Type: text/html说明:属于post方式传图,响应头中Location:定向到的url中包含本次图片上传后,可用于微博中引用的图片id
pid=67351401tw1e0yn91vtjhj;
2.写些文字,提交微博POST http://weibo.com/aj/mblog/add?_wv=5&__rnd=1358561321068 HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
text=[标签:内容]&pic_id=[变量:图片id]&rank=0&rankid=&_surl=topic&hottopicid=&location=home&module=stissue&_t=0说明:属于post请求,post数据中text pic_id字段是主要的变化字段,分别代表内容 图片id,其他字段默认即可;
因此:微博带图发布是需要2次post请求,1.上传图片,获取图片id; 2.完成微博发布;
本人做了这个发布接口,测试如图:
营销推广教程:http://blog.sina.com.cn/iambike007
求分享 gmdinternet@163.com 谢谢 好东西啊,不错,收藏了,呵呵 正在找这个 不知道还能不能用haierdi.com 给发一个吧,yinhaichun0@163.com 强烈支持啊.正好要做这种站. qqqqqqqqqqq俺看看是啥 没有新浪搜索的js采集吗? 收藏备用。沙发么 谢谢分享,下载网址呢