使用FQL或Graph API从旧版fb:comments小部件中检索注释 [英] Using FQL or Graph API to retrieve comments from legacy fb:comments widgets

查看:148
本文介绍了使用FQL或Graph API从旧版fb:comments小部件中检索注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一个客户端一起使用FBML fb:comments小部件和xid参数来在他们的博客上托管评论一段时间。在某些时候,他们添加了migrated = 1参数。



我试图通过Graph API或FQL检索这些评论线程,没有成功。我能够通过一个现代的JS评论小部件设置一个新的页面,并通过任何一种方法检索这些注释,但我不清楚传统评论是如何不同的。



< a href =http://graph.facebook.com/comments/?ids=(page_url =nofollow> http://graph.facebook.com/comments/?ids=(page_url )



返回一个空集,我可以在link_stat表中找到该页面,该表格准确地显示了页面上的注释数量,但尝试通过comment_fbid获取评论字段值也返回空集,同时



http://graph.facebook.com/(comment_fbid)/ comments /



http://graph.facebook.com/comments/?ids=(comment_fbid



与使用object_id = comment_fbid的注释表上的FQL查询一样。



我也尝试过一个FQL查询y与xid =(page_url),无效。



任何关于旧版注释系统如何与Graph API或FQL进行交互的指针都将不胜感激。

解决方案

可能你现在知道了 - 但是我花了很多时间找出一个解决方案,这样其他人可能会发现这有用:




  • 获取访问令牌: https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=<app_id>&client_secret= < app_secret>

  • 现在使用正确的FQL查询,其余的很简单: https://graph.facebook.com/fql ?q = select%20post_id,%20time,%20text%20 from%20comment%20where%20xid =< xid>& access_token =< access_token> 来自注释的文本,其中xid =< xid> )。



显然,您可以自定义FQL查询从评论表



一个(实际上并不那么小)的细节:Facebook将只返回属于你的应用程序的注释,即使没有明确的 app_id 参数。所以为了防止你的xid是1,2,3,你不需要担心。事实上,在我的测试中,如果指定了app_id,Facebook将返回任何条目(即使与以前用于检索访问令牌一样)



正如其他人也提到的,似乎无法获取应用程序的所有评论(不管是xid还是url)。有时在帖子中引用的 comments_info 表格现在似乎完全是空的。


I'm working with a client who has been using the FBML fb:comments widget with the xid parameter to host comments on their blog for quite a while. At some point, they added the migrated=1 parameter.

I am trying to retrieve these comments threads by either the Graph API or FQL, without success. I was able to set up a new page with a modern JS comments widget and retrieve those comments via either method, but I am unclear on how legacy comments are different.

http://graph.facebook.com/comments/?ids=(page_url)

returns an empty set. I can find the page in the link_stat table, which accurately shows the number of comments on the page, but attempting to get the comments with the comment_fbid field value also returns empty sets, with both

http://graph.facebook.com/(comment_fbid)/comments/

http://graph.facebook.com/comments/?ids=(comment_fbid)

as does a FQL query on the comment table with object_id = comment_fbid.

I also tried an FQL query with xid = (page_url), to no avail.

Any pointers on how the legacy comment system interacts with either the Graph API or FQL would be greatly appreciated.

解决方案

Probably you figured this out by now - however I spend quite some time to figure out a solution for this so others might find this useful:

  • Get an access token: https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=<app_id>&client_secret=<app_secret>
  • Now with the right FQL query the rest is simple: https://graph.facebook.com/fql?q=select%20post_id,%20time,%20text%20from%20comment%20where%20xid=<xid>&access_token=<access_token> (select time, text from comment where xid=<xid>).

Obviously you can customize the FQL query to return any parameter from the comments table.

An (actually not so minor) detail: Facebook will return only the comments which belong to your application even without an explicit app_id parameter. So just in case your xids are something 1, 2, 3, you don't need to worry. In fact in my tests Facebook would return no entries if the app_id was specified! (even if it was the same I used to retrieve the access token)

As others have mentioned as well it seems not to be possible to get all comments for an app (regardless of xid or url). The comments_info table which is sometimes referenced in posts seems to be completely empty nowadays.

这篇关于使用FQL或Graph API从旧版fb:comments小部件中检索注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆