简体   繁体   English

使用Graph API代替FQL for Facebook

[英]Using Graph API instead of FQL for Facebook

I have been google searching and stack trolling for something like this but can't seem to find the right formula so I thought I would ask .... 我一直在谷歌搜索和堆栈拖钓这样的事情,但似乎找不到正确的公式,所以我想我会问...。

What I'd like to do is use the Graph API rather then FQL - our application is running with php/graph api calls already, would like to keep it all together. 我想做的是使用Graph API而不是FQL-我们的应用程序已经运行了php / graph api调用,希望将它们保持在一起。

Here is the FQL : 这是FQL:

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'

Tried a bunch of different things, can't seem to translate it - I am going to assume that Link_stat doesn't exist in the graph api, as there is no doc's on it. 尝试了一堆不同的东西,似乎无法翻译它-我将假设在图API中不存在Link_stat,因为上面没有文档。

Figure if it was possible someone might have accomplished it. 弄清楚是否有人可能做到了。

Sample Of What I'd Like 我想要的样品

https://graph.facebook.com/XXXXX/?ids=http:google.com ( somethin like that )

I don't think it's possible to get like count from the graph api, you should use FQL link_stat table. 我不认为有可能从图形API中获得计数,您应该使用FQL link_stat表。 FQL is not deprecated. 不建议使用FQL。

You can try using, 您可以尝试使用,

http://graph.facebook.com/?id=http://www.google.com

and it would return result, 它会返回结果,

{
   "id": "http://www.google.com",
   "shares": 7991103,
   "comments": 807
}

EDIT 编辑

https://developers.facebook.com/docs/reference/fql/ https://developers.facebook.com/docs/reference/fql/

On August 17, 2016, FQL will no longer be available and cannot be queried. 自2016年8月17日起,FQL将不再可用,无法查询。 To migrate your app, use the API Upgrade Tool to see the Graph API calls you can make instead. 要迁移您的应用,请使用API​​升级工具查看您可以进行的Graph API调用。


https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url='http://www.google.com'

And this would return, 这会回来,

{
   "data": [
      {
         "url": "http://www.google.com",
         "normalized_url": "http://www.google.com/",
         "share_count": 4989540,
         "like_count": 1317162,
         "comment_count": 1684401,
         "total_count": 7991103,
         "commentsbox_count": 807,
         "comments_fbid": 396269740024,
         "click_count": 265614
      }
   ]
}

There is a REST API method for the same which is currently deprecated. 目前不建议使用REST API方法。

http://api.facebook.com/restserver.php?method=links.getStats&urls=http://www.google.com

Please Note :Facebook is deprecating the REST API https://developers.facebook.com/blog/post/616/ It would be better to choose Graph API/FQL methods. 请注意 :Facebook不赞成使用REST API https://developers.facebook.com/blog/post/616/最好选择Graph API / FQL方法。

Reference link : Retrieving facebook share count via api 参考链接: 通过API检索Facebook共享计数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM