如何通过 fql 查询 Facebook 对象(例如相册或照片)的点赞数?
这是一个棘手的问题,如何获得 Facebook 对象(例如相册或照片)的点赞数?我知道 facebook 有一个名为 link_stat 的 fql 表,它允许您获取外部 url 的点赞数,但如果该对象位于 facebook 内,它似乎不起作用。如果您通过 opengraph api 访问某个特定对象的点赞,它最多只会返回 4 个点赞该对象的用户,即使可能有几千个用户点赞该对象。有什么线索吗?
Here is a tricky question, how do you get the like count of a facebook object such as an album or a photo? I know that facebook has a fql table called link_stat that allow you to get the like count for an external url, but it does not seem to work if the object is within facebook. If you access the likes via the opengraph api on a particular object, it will only return a maximum of 4 users that like the object, even though there maybe a few thousand users that like it. Any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我可以通过更改隐私设置来做到这一点。如果您在表中查询 XYZ 用户的“喜欢”,则无论您是否请求了权限,除非该用户设置了好友的可见性(照片、相册、视频、链接或注释),否则它都不会返回数据(来自您的应用程序内)。
例如,我是 XYZ 用户,我喜欢我的 GHI 发布的某个链接。我使用为 Facebook 开发的应用程序并允许访问我的链接。现在,如果应用程序尝试访问我在 Facebook 上喜欢的链接,则应用程序将无法获取 GHI 发布的链接(我喜欢的),除非 GHI 已将他/她的链接设置为“朋友”的可见性。
如果有人需要更多帮助,请返回此论坛。
问候,
哈龙
I was able to do this by changing privacy settings. If you query the tables for the likes of XYZ user it will not return the data until and unless the user has set the Visibility to friends (for photo, album, video, link or a note) no matter if you have asked for the permissions( from within your application).
So for instance I am XYZ user and i liked a certain link posted by my GHI. and i use the application developed for Facebook and Allow access to my links. now if the application tries to access links that i have liked on Facebook the application will not be able to get the link posted by GHI (that i liked) until and unless the GHI has set the visibility of his her links to Friends.
if any one needs more help on this then get back on this forum.
regards,
Haroon
请参阅http://developers.facebook.com/docs/reference/fql/like
您可以执行 fql 查询 来检索基于然后对 object_id 进行计数。
See http://developers.facebook.com/docs/reference/fql/like
You can do fql query to retrieve a list of the likes based on the object_id then do a count.
显然,自从您第一次提出问题以来,答案已经发生了很大变化,但这是今天的答案。使用 Facebook Graph API 了解如何从 Facebook 获取相册中每张照片的信息:
使用 Ajax 发送 GET 请求:
变量“afterStr”是下一页数据的 ID。
然后执行以下操作来计算我们从 Facebook 获得的点赞和评论:
使用 ID 将结果发布到您的 HTML 中:
工作 demo在这里。
希望这有帮助!
Obviously the answer has changed a lot since you first asked the question but here is the answer as of today. Use the Facebook Graph API to figure out how to get the info about each photo in the album from Facebook:
Use Ajax to send the GET request:
The variable 'afterStr' is the ID of the next page of data.
Then the following to count the likes and comments we got from Facebook:
Post the result into your HTML using ID's:
Working demo here.
Hope this helps!
如今,如果您知道要查询的帖子类型,您也许可以使用 FQL。例如,如果您想知道一张照片有多少个赞,您可以使用:
返回以下内容:
对于不同类型的内容,存在类似的方法,但对我来说似乎不一致,因此请查看 FQL 文档。
https://developers.facebook.com/docs/reference/fql/
These days, if you know what type of post you are querying, you may be able to use FQL. For example if you want to know how many likes there are for a photo you can use:
Which returns the following:
Similar approaches exist for different types of content but it seems inconsistent to me so have a look in the FQL documentation.
https://developers.facebook.com/docs/reference/fql/