如何列出我的域中的所有注释 [英] How to list all comments in my domain
问题描述
我在我的网站上使用HTML5版本的 Facebook Comment
。我有自己的Facebook APP Id。
使用 Graph-API
和 FQL
(我想这是怎么做的),我想列出我网站上发布的所有评论。
示例 -
页面标题1
--Comment1
--Comment2
--Comment3
页面Title2
--Comment1
--Comment2
--Comment3
页面标题3
--Comment1
--Comment2
--Comment3
等
请帮助我。 / p>
只要您有一个固定子集,就有两种不同的方式要从其中提取评论的页面。
如果您有大量的子页面或可变量,那么您没有一个很好的可扩展解决方案 - 而且许多都在寻找一个:
- Facebook fb :评论Graph API
- 如何显示Facebook的最新评论评论社交插件?
- Facebook FQL查询返回对应用程序的所有评论
- 应用程序ID使用FQL检索所有注释
- Facebook FQL查询返回对应用程序的所有评论
- fql查询以获取评论数更长的工作
- http://facebook.stackoverflow.com/questions/10023179/retrieve-all-the-comments-posted-using-fql
对于您网站中的固定子页面集,您可以使用批处理请求或FQL查询。
批量请求
首先,您需要访问令牌。只需在浏览器中输入以下内容作为url(信用于这个网站):
这是一个javascript jquery代码,用于进行批处理请求以从多个URL一次性获取注释:
$。ajax({
url:'https://graph.facebook.com/',
type:POST ,
data:{
access_token:'YOUR_APP_ACCESS_TOKEN',
batch:'[\
{method:GET,ative_url:URL1} ,\
{method:GET,relative_url:URL2} \
]'
},
success:function(d ata){
jdata = JSON.parse(data);
$ .each(jdata,function(index,value){
jdata [index] .body = JSON.parse(value.body);
console.log(value.body);
});
//用jdata
}
}做任何你想要的任何事情;
FQL
< hr>
灵感来源于这个帖子
FB.api({
method:'fql.query',
query: 'select comment from comment where object_id in(select comments_fbid from link_stat where url =URL1or url =URL2)'
},function(response){
// do something with results
});
结论 p>
由于Facebook的这种限制,我打算切换到disqus.com,这显然支持这个功能(从这个 blog ,(搜索最近评论)
I am using the HTML5 version of Facebook Comment
in my website. I have my own Facebook APP Id.
Using Graph-API
, and FQL
(I think this is how to do it), I want to list all the Comments posted in my website.
Example -
Page Title1
--Comment1
--Comment2
--Comment3
Page Title2
--Comment1
--Comment2
--Comment3
Page Title3
--Comment1
--Comment2
--Comment3
etc.
Please help me out.
It is possible, in two different ways, as long as you have a fixed set of sub-pages you want to fetch comments from.
If you have a large amount of sub-pages, or a variable amount, then you don't have a good scalable solution - and many have been looking for one:
- Facebook fb:comments Graph API
- How to display recent comments from Facebook Comments social plugin?
- Facebook FQL query to return all comments against an application
- Retrieve all comments with FQL by application ID
- Facebook FQL query to return all comments against an application
- fql query to get comment count no longer working
- http://facebook.stackoverflow.com/questions/10023179/retrieve-all-the-comments-posted-using-fql
For a Fixed set of sub-pages in your website, you can either use a batch request, or an FQL query.
Batch Request
First, you need your access token. Just enter the following as a url in a browser (credit to this website ):
And this is the javascript jquery code to make a batch request to fetch comments from several urls at once:
$.ajax({ url: 'https://graph.facebook.com/', type : "POST", data: { access_token : 'YOUR_APP_ACCESS_TOKEN', batch : '[ \ {"method":"GET","relative_url":"URL1"}, \ {"method":"GET","relative_url":"URL2"} \ ]' }, success: function(data) { jdata = JSON.parse(data); $.each(jdata, function(index,value){ jdata[index].body = JSON.parse(value.body); console.log(value.body); }); // Do whatever you want with jdata } });
FQL
inspired from this post
FB.api({ method: 'fql.query', query: 'select text from comment where object_id in (select comments_fbid from link_stat where url="URL1" or url="URL2")' }, function(response) { // Do something with results });
Conclusion
Because of this limitation of Facebook, I plan to switch to disqus.com, which apparently supports this feature (As you can see from this blog, for example. (search for 'recent comments')
这篇关于如何列出我的域中的所有注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!