我正在使用Facebook API获取给定URL的类似/共享计数.奇怪的是,返回结果似乎很不一致.例如,此页面返回结果:
https://api.facebook.com/method/fql.query?query=select%20total_count,like_count,comment_count,share_count,click_count%20from%20link_stat%20where%20url='http://www.groupon.com/deals/seattlehelitourscom-by-classic-helicopter-corp'&format=json
然而,这个不是:
https://api.facebook.com/method/fql.query?query=select%20total_count,like_count,comment_count,share_count,click_count%20from%20link_stat%20where%20url='http://www.livingsocial.com/deals/278194-sunset-kayaking-hot-chowder'&format=json
第二页显然有一个共享计数,当我检查页面的HTML时,用于共享的URL是我在上面的API请求中放置的URL.但是,API不响应任何数量的喜欢或分享的任何计数信息.
关于为什么API可能会响应某些URL而不是其他URL的任何线索?
Facebook计划在V2.0之后放弃对FQL的支持https://developers.facebook.com/docs/apps/changelog/#v2_0_fql
使用FQL可以轻松完成以下任务
SELECT like_info.like_count, comment_info.comment_count, share_count
FROM stream
WHERE post_id = "POST_ID_HERE"
Run Code Online (Sandbox Code Playgroud)
我无法在图api中找到上述方法的替代品.我知道我们可以得到喜欢和评论
POST_ID/likes?summary=true AND
POST_ID/comments?summary=true
Run Code Online (Sandbox Code Playgroud)
但我无法找到类似的股票终点.
注意:我不是在寻找能够获取URL输入和查询图形api的解决方案,而是寻找通过POST_ID获取共享计数的解决方案
PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)
Run Code Online (Sandbox Code Playgroud)
我看过了.
结果应该是这样的:
{
"data": [{
"like_info": {
"like_count": 3506
},
"comment_info": {
"comment_count": 263
},
"share_count": 278
}]
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将受到高度赞赏.
干杯!
更新:这是一个访问令牌问题,因为我使用的令牌没有"read_stream"权限.