简体   繁体   English

如何使用restfb在Facebook中获取评论图片?

[英]How to get attached comment pictures in Facebook with restfb?

I'm having troubles getting the attached image of a comment to a status update in a Facebook page using restfb. 我无法使用restfb在Facebook页面中将评论的附件图像更新为状态更新。

I'm commenting a status update in the page (did by myself) and adding a picture. 我要在页面中评论状态更新(由我自己做)并添加图片。 I'd like to get that picture, but the Comment object returned has always the attachment set to null...here is the code: 我想获取该图片,但是返回的Comment对象始终将附件设置为null ...这是代码:

JsonObject commentAsObject = FacebookUtils.getCommentAsObject(access_token, commentId);
Comment comment = FacebookUtils.getComment(access_token, commentId);
if (comment.getAttachement() != null)
    //Do something

The commentId is valid, I build the permalink using that ID and it works...and the returned Comment object has all the values, like message OK, but the picture is not present...thus, does restfb return any of this? commentId是有效的,我使用该ID构建了永久链接,并且可以正常工作...返回的Comment对象具有所有值,例如消息OK,但图片不存在...因此,restfb是否返回任何其中的一个?

Thanks! 谢谢!

您构建的用于获取注释的请求需要fields=attachment参数,因为只有明确请求时才返回此字段。

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

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