Facebook Graph的空白回应 [英] Empty response from Facebook Graph

查看:218
本文介绍了Facebook Graph的空白回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获得有关Facebook,Facebook,Twitter上分享的喜好,评论和分享的数量和信息。即使它在大多数情况下起作用,有时我从Graph API收到空JSON响应。



代码

  import facepy ,pprint 

long_access_token =访问令牌

graph = facepy.GraphAPI(long_access_token)
limit = 1
user_id =4
post_id =10101319050523971

g = graph.get(post_id +'/ sharedposts?limit =%s'%(limit))
pprint.pprint(g)

输出:

  {u'data':[]} 

请注意,一个href =https://www.facebook.com/zuck/posts/10101319050523971 =nofollow> post 有超过200K的喜欢和30K的股份。相比之下,具有30K喜欢和2K股的发布精彩地工作。所以我认为这是一个帖子大小的问题。



如何处理大量喜欢,评论,分享的帖子?我想得到有关用户的信息以及信息。

解决方案

实际上,你不应该能够从中受益,因为他显然不会使用你的应用程序。 >

您可以调用POST_ID端点,因为此帖子的类型是链接类型





即使你可以'从zuck检索feed:





但是,您可以获得zuck分享的公共链接:





这是我从Facebook收到的回复:




I'm trying to get counts and information about likes, comments, and shared of posts on Facebook. And even though it works in most cases, sometimes I receive "empty" JSON response from Graph API.

Code:

import facepy, pprint

long_access_token = "Access token"

graph = facepy.GraphAPI(long_access_token)
limit = 1
user_id = "4"
post_id = "10101319050523971"

g = graph.get(post_id + '/sharedposts?limit=%s' %(limit))
pprint.pprint(g)

Output:

{u'data': []}

Note that this post has more than 200K likes and 30K shares. In contrast a post with 30K likes and 2K shares works beautifully. So I assume it's an issue of the "size" of a post.

How can I handle posts with large number of likes, comments, shares? I want to get counts as well as information about users.

解决方案

Actually you're not supposed to be able to get feed from zuck because he obviously not using your app.

You can call the POST_ID endpoint because the type of this post is a link type

Even though you can't retrieve feed from zuck:

But, you can get the public link shared by zuck:

This was the response i received from Facebook:

这篇关于Facebook Graph的空白回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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