Ash*_*kar 136 facebook facebook-like facebook-graph-api
我可以使用PHP SDK和使用弃用的rest API获取URL的共享计数,但是没有找到使用图API获取URL的共享计数的方法.
有没有办法找出来?
cha*_*eet 270
以下是获取统计信息的API链接列表:
Facebook: https
://api.facebook.com/method/links.getStats ? urls = %%URL %% & format = json Reddit:http://buttons.reddit.com/button_info.json ? url = %% URL% %
LinkedIn:http
://www.linkedin.com/countserv/count/share ? url = %% urL %%& format = json Digg:http://widgets.digg.com/buttons/count ? url = %% urL %%
美味:http://feeds.delicious.com/v2/json/urlinfo/data?
url = %% URL %% StumbleUpon:http://www.stumbleupon.com/services/1.01/badge.getinfo ? url = %% URL %%
Pinterest:http://widgets.pinterest.com/v1/urls/count.json? source = 6&url =%%URL %%
编辑:删除了Twitter端点,因为该端点已被弃用.
编辑:Facebook REST API已弃用
ifa*_*our 200
更新 - 2015年4月:
如果要获取Like按钮中可用的计数,则应使用对象中的engagement
字段og_object
,如下所示:
https://graph.facebook.com/v2.2/?id=http://www.MY-LINK.com&fields=og_object{engagement}&access_token=<access_token>
Run Code Online (Sandbox Code Playgroud)
结果:
{
"og_object": {
"engagement": {
"count": 93,
"social_sentence": "93 people like this."
},
"id": "801998203216179"
},
"id": "http://techcrunch.com/2015/04/06/they-should-have-announced-at-420/"
}
Run Code Online (Sandbox Code Playgroud)
使用Graph API可以使用:
http://graph.facebook.com/?id=YOUR_URL
Run Code Online (Sandbox Code Playgroud)
就像是:
http://graph.facebook.com/?id=http://www.google.com
Run Code Online (Sandbox Code Playgroud)
会回来:
{
"id": "http://www.google.com",
"shares": 1163912
}
Run Code Online (Sandbox Code Playgroud)
更新:虽然以上将回答如何获得份额.此数字不等于您在Like按钮上看到的数字,因为该数字是以下数字的总和:
因此,使用Graph API通过fql
端点(link_stat
表格)可以获得Like按钮编号:
https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://www.google.com'
Run Code Online (Sandbox Code Playgroud)
total_count
是Like按钮中显示的数字.
fre*_*dev 21
你不应该使用graph api.如果你打电话:
要么
两者都会回归:
{
"id": "http://www.apple.com",
"shares": 1146997
}
Run Code Online (Sandbox Code Playgroud)
但显示的数字是:
所以你必须使用FQL.
看看这个答案: 如何从文章中获取Facebook喜欢,分享,评论数量
Gio*_*sta 14
2016年8月7日之后,你仍然可以这样打电话:
http://graph.facebook.com/?id=https://www.apple.com/
Run Code Online (Sandbox Code Playgroud)
但响应格式将会有所不同:它不会
{
"id": "http://www.apple.com",
"shares": 1146997
}
Run Code Online (Sandbox Code Playgroud)
但相反它会
{
"og_object": {
"id": "388265801869",
"description": "Get a first look at iPhone 7, Apple Watch Series 2, and the new AirPods \u2014 the future of wireless headphones. Visit the site to learn more.",
"title": "Apple",
"type": "website",
"updated_time": "2016-09-20T08:21:03+0000"
},
"share": {
"comment_count": 1,
"share_count": 1094227
},
"id": "https://www.apple.com"
}
Run Code Online (Sandbox Code Playgroud)
所以你必须像这样处理响应:
reponse_variable.share.share_count
Run Code Online (Sandbox Code Playgroud)
我发现有用的,我在上面的一个链接上找到的是这个FQL查询,你可以通过查看link_stat表来询问一个链接的喜欢,总数,分享和点击次数
https://graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%22http://google.com%22
Run Code Online (Sandbox Code Playgroud)
这将输出如下内容:
{
data: [
{
like_count: 3440162,
total_count: 13226503,
share_count: 7732740,
click_count: 265614,
comment_count: 2053601
}
]
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
166640 次 |
最近记录: |