通过api检索facebook分享数 [英] Retrieving facebook share count via api

查看:101
本文介绍了通过api检索facebook分享数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Facebook的api得到喜欢的事情。如果您访问此网址 http: //api.facebook.com/restserver.php?method=links.getStats&urls=http://www.yahoo.com



like_count目前在 422493 附近。但是,如果我运行这个jQuery脚本( JSFiddle ),它会显示 1318998 。这个脚本有什么问题吗?

 < script> 
$ .ajax({
url:http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.yahoo.com;,
dataType:xml
})。done(function(data){
var $ xml = $(data),
$ title = $ xml.find(like_count );
$('#fbshare')。text($ title.text());
});
< / script>

< div id =fbshare>< / div>

API从这里引用: https://developers.facebook.com/blog/post/2009/10/26/extending-facebook-share/

解决方案

尝试此FQL查询,希望这将有所帮助。



https://api.facebook.com/method/fql.query?query=select%20%20like_count%20from%20link_stat%20where%20url=%22www.yahoo.com%22


Im trying to get like counts from facebook's api. If you access this url http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.yahoo.com

the like_count is currently around 422493. But if I run this jQuery script(JSFiddle) it displays 1318998. Is there something wrong with this script?

<script>
$.ajax({
    url: "http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.yahoo.com;",
    dataType: "xml"
}).done(function(data) {
    var $xml = $(data),
        $title = $xml.find("like_count");
    $('#fbshare').text($title.text());
});           
</script>

<div id="fbshare"></div>

API is referenced from here: https://developers.facebook.com/blog/post/2009/10/26/extending-facebook-share/

解决方案

Try this FQL query,Hope this would help.

https://api.facebook.com/method/fql.query?query=select%20%20like_count%20from%20link_stat%20where%20url=%22www.yahoo.com%22

这篇关于通过api检索facebook分享数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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