2016-05-24 29 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