Facebook 粉丝页面和相关开放图对象

发布于 2024-12-06 15:23:42 字数 1530 浏览 0 评论 0原文

如果存在这样的 facebook 粉丝页面:

https://www.facebook.com/HuffingtonPost 

我想通过调用 graph 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 的故事的点赞数和评论数
  • 收件箱消息数包含此 URL 作为附件。

在第二种情况下,像计数只代表它自己

有人可以确认我分享计数的正确性吗?

If exist a facebook fan page like this:

https://www.facebook.com/HuffingtonPost 

I suppose to get likes count calling graph API:

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

Infact here I get:

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

On the other hand if I call

https://graph.facebook.com/HuffingtonPost

I get a more verbose output:

{
   "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 ...]

}

Can anybody tell me what's difference between these two opengraph objects?
There is also a slight difference between number of shares and likes. Why?

Update:

During last days graph api returned also object type, so I realized that:

  • First API call returns an link_stat type object.
  • Second API call returns a page type object.

In first case shares count should represent sum of:

  • number of likes of this URL
  • number of shares of this URL (this includes copy/pasting a link back to Facebook)
  • number of likes and comments on stories on Facebook about this URL
  • number of inbox messages containing this URL as an attachment.

In second case like count represents only itself

May somebody confirm me shares count correctness?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉城凉梦凉人心 2024-12-13 15:23:42

对于喜欢、分享和评论之间的细分(它们被添加并用作喜欢按钮上的“喜欢”数字,您最好使用 FQL。

如果您使用 OG,类似于 http://graph.facebook.com/http://example.com 将向您展示:

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

... 信息。

<?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>';

?>

如果您使用 FQL,您可以得到每个的详细 在屏幕上显示如下内容:

* 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。

For the breakdown between likes, shares and comments (which are added up and used as the "likes" number on the likes button, you're better off using FQL.

If you use OG, something like http://graph.facebook.com/http://example.com will show you:

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

... as you've noted above. If you use FQL, you can get the breakdown of each.

<?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>';

?>

This will display something on-screen like:

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

)

Also, SA now has a Facebook-specific site that may be helpful to you. :) facebook.stackoverflow.com

木有鱼丸 2024-12-13 15:23:42

第一个是告诉您所选网址有多少个赞。
使用第二个,您将通过页面标识符获取有关页面对象的信息

First one is something that tells you how many likes selected url have.
Using second one you will get information about Page Object through page identifier

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文