1.加入微博的js,这个app_id和微游戏的app_id通用
<script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=<?php echo $sns_config['app_id']; ?>" type="text/javascript" charset="utf-8"></script>
2.取得当前自己的所有粉丝
/**
* 新浪平台在线可互粉的玩家
*
*/
refleshOnline : function(){
var _this = this;
if(this.initData.fansIds){
this.showFans(this, this.initData.fansIds);
}else{
WB2.anyWhere(function(W){
W.parseCMD("/friendships/friends/ids.json", function(sResult, bStatus){
_this.initData.fansIds = sResult.ids;
_this.showFans(_this, sResult.ids);
},{
uid : _this.initData.playerId
},{
method: 'get'
});
});
}
},
3.显示互粉的好友信息
/**
* 显示互粉
*
* @obj _this
* @array fans_uids
*/
showFans : function(_this, fans_uids){
var _postData = {'action' : 'reflesh', 'USERNAME' : _this.initData.playerName, 'uid' : _this.initData.playerId, 'fans_ids' : fans_uids};
_this.post('ajax_get.php', _postData, function(data){
var response = JSON.parse(data);
$('#onlineusers').empty();
var index = 0;
$('#onlineusers').append("<li style=\"width: 16px; padding: 0pt 2px 2px; background: none repeat scroll 0% 0% rgb(96, 175, 5); color: rgb(255, 255, 255);\">正在线上的人</li>");
for(var uid in response['data']){
$('#onlineusers').append("<li id=\"tips_" + index + "\">"+"<a href='http://www.weibo.com/"+uid+"' target='_blank' alt='" + response['data'][uid].first_name + "'> <img border=0 src='"
+ "http://tp3.sinaimg.cn/" + uid + "/50/5608956130/0" + "' alt='" + response['data'][uid].first_name + "'/></a><br/><a href=\"http://www.weibo.com/"+uid+"\" target=\"_blank\" title='"+response['data'][uid].first_name +"'>"
+ _this.subUserName(response['data'][uid].first_name) + "</a><a href=\"javascript:;\" onclick=\"Atlantis.addFriends('"+response['data'][uid].uid+"',this)\" class=\"log_add\">+ 加关注</a></li>");
index++;
}
});
},
3.增加互粉接口
/**
* 新浪微博API:增加互粉
*
* @string uid
* @obj element
*/
addFriends : function(uid,element){
var _this = this;
WB2.anyWhere(function(W){
W.parseCMD("/friendships/create.json", function(sResult, bStatus){
_this.initData.fansIds.push(uid);
$(element).addClass('log_concerned').empty().append('<em>√</em>已关注').removeAttr("onclick");
},{
uid : uid
},{
method: 'post'
});
});
},
4.截取
subUserName : function(username){
if(username.length < 10)
return username;
return username.substring(0, 10) + "...";
},
分享到:
相关推荐
多线程实现新浪微博粉丝抓取,快速抓取fans,follow,代码很简单主要是思路
用Java实现的新浪微博抓取关注列表和粉丝列表课程设计报告
这是新浪微博爬虫,采用python+selenium实现。 免费资源,希望对你有所帮助,虽然是傻瓜式爬虫,但是至少能运行。同时rar中包括源码及爬取的示例。 参考我的文章: ...[python爬虫] Selenium爬取新浪微博内容及用户...
新浪微博控培训PPT-微博粉丝增长秘诀培训PPT
新浪微博C#版SDK Demo 包含获取个人信息、获取会员好友信息。。。
使用aspx开发的新浪微博粉丝转发平台,开发语言C#
新浪微博-2018年微博粉丝白皮书-2019.07-69页.rar
3.支持采集功能,可以监测指定微博的赞,关键词,指定微博粉丝地址等条件采集微博ID 4.支持群发评论,私信,关注等功能,可以选择过虑已发送微博 5.支持带本地图片发表微博,指定微博评论 6.支持宽带拔号等换ip方式...
NULL 博文链接:https://wanshouli.iteye.com/blog/842112
新浪微博应用 测试粉丝质量 源代码
新浪微博粉丝群玩法宝典.docx
新浪微博粉丝增加与推广方式,很有用哦.微博大家都上的吧,粉丝多了甚至可以用作商业用途,你懂得。。
【行业案例】K12教育微博超级粉丝通案例
新浪微博粉丝通信息流渠道运营经验.pptx
新浪微博爬虫,功能包括:爬取用户信息、关注、粉丝,爬取超级话题用户及粉丝相关信息
10.2_开发粉丝列表|关注和取消关注|Node.js-Koa2框架从零开发仿新浪微博项目实战