开发者

Getting comments from Facebook photos

I'm working on a project and I need to retrieve all of the photos a user is tagged in, that's not a problem. I also need to get a list of all comments for each photo, which has proved to be somewhat annoying. Here is what I think should work:

<!DOCTYPE html>

<html>
    <head>
        <title>HipWall</title>
    </head>

    <body>

        {% for photo in stream["data"] %}                                                                                                                                           

            {{ photo["comments"] }}<br /><br />

        {% end %}

    </body>
</html>

Where stream holds the response from calling https://graph.facebook.com/me/photos

Aside from "comments", everything else seems to work. "pictures", "source" and "tags" all return what they should.

When开发者_运维问答 I start up my server though I get a 500: Internal Server Error response and my logs tell me that photo["comments"] is a key error.

What's going on?


First of all, your question is a bit vague. What template engine do you use, how do you put together the data?

But, to answer your question: The photo stream does not include comments innately. There is only a connection to photos available. Have a look at the Graph API Explorer. You need to get the comments for each photo with graph.facebook.com/PHOTO_ID/comments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜