2016-05-24 28 views
1

使用FQLREST API因为这将是弃用8月18日,请不要提供解决方案2016onwards获得像数,股数和评论数在FB图形API 2.7

我想获取所有喜欢,评论&股份的任何网址。到目前为止,我有两个方法

REST API

https://api.facebook.com/restserver.php?format=json&method=links.getStats&urls=http://www.thestorypedia.com/how-your-personality-impacts-the-way-your-dates-go/ 

FQL

https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url=%27http%3A%2F%2Fwww.thestorypedia.com%2Fhow-your-personality-impacts-the-way-your-dates-go%2F%27 

上述这些问题都工作,但采用图形API的2.0版,并将于已弃用从2016年8月7日

任何人都可以给我一个工作网址为v2.7与上述所有离子计数

+0

https://developers.facebook.com/docs/graph-api/reference/v2.6/url – CBroe

+0

只发现评论和分享次数没有相似的次数 – Cybersupernova

+0

'share_count'应该与官方的价值相同像按钮插件会显示。 – CBroe

回答

5

我想你将不得不切换到图表api分享和评论计数。随着对于Facebook的JavaScript SDK,你可以写:

var access_token = "your_app_access_token"; 
var url = "your_url_here"; 
FB.api("http://graph.facebook.com/v2.7/?id=" + current_url + "&access_token=" + access_token,function(data){ 
     console.log(data); 
     // you will get data here like this 
     // { 
      // "og_object": { 
      // "id": "12208906XXXXXX", 
      // "description": "The Rio Olympic Game XXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX", 
      // "title": "The Rio Olympic Game XXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX", 
      // "type": "website", 
      // "updated_time": "2016-08-23T13:14:35+0000" 
      // }, 
      // "share": { 
      //  "comment_count": 12345, 
      //  "share_count": 5234 
      // }, 
      // "id": "your_url_here" 
     //} 
    }); 

在这里,你可以从data.share访问SHARE_COUNT和COMMENT_COUNT。 希望它有帮助!

+5

像伯爵呢? – Cybersupernova