2

如果存在一個Facebook粉絲頁面是這樣的:Facebook粉絲頁面和相關的開放圖形對象

https://www.facebook.com/HuffingtonPost 

我想獲得喜歡計數調用圖形API:這裏

https://graph.facebook.com/https://www.facebook.com/HuffingtonPost 

逸岸,我得到:

{ 
    "id": "https://www.facebook.com/HuffingtonPost", 
    "shares": 435839 
} 

,如果我叫

另一方面
https://graph.facebook.com/HuffingtonPost 

我得到一個更詳細的輸出:

{ 
    "id": "18468761129", 
    "name": "The Huffington Post", 
    "picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/188072_18468761129_6398033_s.jpg", 
    "link": "http://www.facebook.com/HuffingtonPost", 
    "likes": 435832, 
    "category": "Website", 
    "website": "http://www.facebook.com/HuffingtonPost", 
    "username": "HuffingtonPost", 
    "company_overview": "The Internet Newspaper\nNews | Blogs | Video | Community", 
    "description": "The Huffington Post - The Internet Newspaper. - Company Overview: The Internet Newspaper News | Blogs | Video | Community | Facebook", 

     [... omissis ...] 

} 

誰能告訴我什麼是這兩個opengraph對象之間的區別?
股數和喜歡之間也有細微的差異。爲什麼?

更新:

在最後的日子裏圖形API返回的對象還的類型,所以我才意識到:

  • 首先API調用返回link_stat類型的對象。
  • 第二個API調用返回一個頁面類型對象。

在第一種情況下股數應代表的總和:

  • 數目這個URL
  • 數的這個URL的股的喜歡的(這包括複製/粘貼鏈接回到Facebook)的
  • 在Facebook上關於此網址的點贊和評論數量
  • 包含此URL作爲附件的收件箱郵件的數量。

在第二種情況下像數僅代表自身

五月有人確認我算股份的正確性?

回答

2

欲瞭解喜歡,分享和評論之間的細分(它們被添加並用作喜歡按鈕上的「喜歡」數字,你最好。使用FQL

如果使用OG,像http://graph.facebook.com/http://example.com會告訴你:

{ 
    "id": "http://example.com", 
    "shares": 3 
} 

...如你上面提到如果使用FQL,你可以得到每個細分。

<?php 

// require the php sdk 
require_once 'facebook-php-sdk/src/facebook.php'; 

// Create our Application instance. 
$facebook = new Facebook(array(
    'appId' => 'YOUR_APP_ID', 
    'secret' => 'YOUR_APP_SECRET', 
    'cookie' => true, 
)); 

$external_result = $facebook->api(array(
'method' => 'fql.query', 
'query' => 'SELECT share_count, like_count, comment_count, total_count, click_count FROM link_stat WHERE url="http://example.com";' 
)); 

echo '<li>'.number_format($external_result[0]['like_count']).' likes, '.number_format($external_result[0]['share_count']).' shares'; 

echo '<pre>'; 
print_r($external_result); 
echo '</pre>'; 

?> 

這將顯示在屏幕上是這樣的:

* 1 likes, 2 shares 
Array 
(
    [0] => Array 
     (
      [share_count] => 2 
      [like_count] => 1 
      [comment_count] => 0 
      [total_count] => 3 
      [click_count] => 0 
     ) 

) 

此外,SA現在有可能對你有幫助的特定的Facebook站點。 :) facebook.stackoverflow.com

+0

您是否嘗試在http://www.facebook.com/HuffingtonPost上使用FQL link_stat?您將收到所有設置爲0的計數器。 – freedev

+0

當URL以Facebook開頭時,我不認爲FQL查詢按預期工作。他們希望在FB上的頁面上使用圖形對象。您將獲得對象ID並使用:'query'=>'SELECT share_count,like_count,comment_count,total_count,click_count FROM like WHERE object_id =「18468761129」;' – snipe

2

第一個是告訴你有多少喜歡選定的網址。 使用第二個,你將通過頁面標識符獲得有關頁面對象的信息

+0

股票和喜歡數字之間的差異呢? – freedev