0
我試圖根據性別來分列我的朋友列表,但我不知道如何從他們的id中獲得朋友性別並按性別列出朋友。目前我有他們的id和個人資料照片列出。基本上我需要的只是如何獲得他們的性別並對朋友進行分類。Facebook圖api,得到朋友的性別
for friend in friends
.col-xs-3.col-md-2
p #{friend.id}
a.thumbnail(href='http://facebook.com/#{friend.id}')
img(src='https://graph.facebook.com/#{friend.id}/picture?width=150&height=150')
exports.getFacebook = function(req, res, next) {
var token = _.find(req.user.tokens, { kind: 'facebook' });
graph.setAccessToken(token.accessToken);
async.parallel({
getMe: function(done) {
graph.get(req.user.facebook, function(err, me) {
done(err, me);
});
},
getMyFriends: function(done) {
graph.get(req.user.facebook + '/friends', function(err, friends) {
done(err, friends.data);
});
}
},
function(err, results) {
if (err) return next(err);
res.render('api/facebook', {
title: 'Facebook API',
me: results.getMe,
friends: results.getMyFriends
});
});
};