我们想将Facebook点赞数用于基于点赞的图表。通过Facebook的Graph API获得资源的喜欢计数非常容易。
$ curl http://www.example.com/some/resource
{
"id": "123456789",
"name": "Resource Name",
"link": "http://www.example.com/some/resourceL",
"likes": 26
}
我遇到的问题是,“赞”按钮显示的赞次数比从Graph API获得的赞要多得多。我们网站上的“喜欢”按钮显示了100多个“喜欢”。这似乎是正确的行为:
什么由我的“赞”按钮上显示的数字组成?
显示的数字是以下各项的总和:
这个网址的喜欢人数
此URL的共享数(包括复制/粘贴回Facebook的链接)
在Facebook上有关此URL的故事的喜欢和评论次数
包含此URL作为附件的收件箱消息数。
http://developers.facebook.com/docs/reference/plugins/like/
我们只想在按钮上显示真实的喜欢计数。没有其他的。在按钮上显示另一个数字会使我们的用户感到困惑。有办法实现吗?
我不认为现在有任何巧妙的方法可以做到这一点。但是,您可以使用旧的rest api的getstats方法获取统计信息,进行少量分析并显示出来。请注意,该链接中的示例现在不起作用,您需要提供一个access_token,以将您限制为每600秒600个请求。
This is the only answer I've found for this problem thus far. Seems like the opengraph doesn't yet return 'shares' for an object, which conversely are added to the like button's total_count. I've been trying to use like buttons as a voting mechanism in different projects for a while now, and thought I'd finally cracked it with a combo of cron-jobed opengraph queries, and javascript callbacks on the like buttons themselves. It's sad to learn that I may have to go back to the old REST API to make this work... In my experience When FB 'deprecates' something, it's not long for this world.