如何獲取喜歡Facebook用戶信息的朋友列表?我嘗試這樣做的代碼:返回Java中的Facebook朋友列表
public class main {
public static void main(String[] args) throws IOException {
String accessToken = "EAACEdEoseZBhf0e4WXHuNaItvLeoAZD";
FacebookClient fbclient = new DefaultFacebookClient(accessToken);
Connection<Post> result = fbclient.fetchConnection("me/feed", Post.class);
int counter = 0;
for (List<Post> page : result) {
for (Post aPost : page) {
Date time = aPost.getCreatedTime();
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, -10);
Date db = c.getTime();
{
if (!time.before(db)) {
System.out.println("created time " + time + "\r\n");
System.out.println("Id Poste: fb.com/" + aPost.getId() + "\r\n");
System.out.println(" L(userx) " + aPost.getLikes());
counter++;
} else {
System.out.println("date hors période" + "\r\n");
}
}
}
}
}
但像列表的結果是:
喜歡[數據= [NamedFacebookType [ID = 758248010897019元數據= null名稱=十日EP Bouzidi類型=空] ,NamedFacebookType [id = 836615436419028 metadata = null name = Basma Youssfi type = null],NamedFacebookType [id = 200283693703077 metadata = null name = Sahar Hmidet type = null],NamedFacebookType [id = 1589600437936215 metadata = null name = Fifi Daly Omm Omar type = null],NamedFacebookType [id = 2285678608326303 metadata = null name =RàNou type = null],NamedFacebookType [id = 149760905397346 metadata = null name = Awatef Cherif type = null],NamedFacebookType [id = 197868283998495 meta名稱FacebookType [id = 191663454652822 metadata = null name = Ben Ali Fatma Benali type = null],NamedFacebookType [id = 1594576777456573 metadata = null name = Rania Trigui type = null],NamedFacebookType [空格名稱= Samar Maamouri type = null] ID = 10204633957434960元數據= null名稱= Gasmi Ghassen類型=空]] TOTALCOUNT = 0]
========================= ==========
我需要它返回用戶的朋友的名字。
我想要的輸出是這樣的:創建時間:週六6月03 21時19分58秒CEST 2017年 郵政編號:fb.com/1562752627337463_1944745292471526 清單當然的朋友: 埃斯梅拉達Sagittaire 本·阿里法特瑪·本·阿里 穆納阿莫爾 Hala Ben Mouhamed Awatef Cherif Safa Chebbi – Intissar