获取用户的Facebook好友共享的任何类型的所有链接

时间:2014-04-18 07:31:26

标签: facebook-graph-api facebook-fql

我试图让用户的朋友分享所有链接我尝试了以下问题的所有查询和请求,

How do I get a friend's links with Facebook's graph api?

Finding who shared a link publicly and finding who reshared a given link

Facebook API: All links shared by all friends?

get shared links on facebook newsfeed

但无法弄清楚确切的FQL或请求网址是什么,以便从定义的过去时间间隔内从我的朋友那里分享所有链接。我是图API和FQL的新手,所以请帮我弄清楚这样做的方法。

我尝试了一个简单的查询

SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls FROM link WHERE owner IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 100) 

但我得到

{
  "error": "Request failed"
}

作为API Explorer的响应。

1 个答案:

答案 0 :(得分:1)

您的查询太长,FQL无法构建答案。如果你试试这个:

SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls
       FROM link WHERE owner IN 
       (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 10)

(同样的查询,只有限制设置为10而不是100)FQL资源管理器会认为~5-8secs然后给你回复结果。或者,如果您不会收到结果,则必须再次减少限制。

所以你有两个选择:

  1. 您可以将限制从100降低到10或更低,并且无需更改即可运行查询
  2. 您可以运行查询

    SELECT uid2 FROM friend WHERE uid1 = me()

  3. 然后为每个收到的朋友ID运行另一个查询

    SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls
           FROM link WHERE owner = FRIEND_ID