J. Wong
J. Wong

Reputation: 21

Facebook Graph API: Extracting Comments

I'm having difficulty in extracting comments from a post on a Facebook page using the Graph API. Right now, I am able to get some comments from a post using the following query:

GET/v2.7/{user_id}_{post_id}/comments

Where the user_id and post_id fields are variable depending on the post I'm trying to extract the comments for. While I'm able to get most of the comments from the post, I'm not able to extract comments of comments (or replies to comments). Basically, I woudl like to be able to extract the comments of comments on the parent post in addition to just comments on the parent post (which I am already able to get).

Is there any way to do this? Thanks for your help.

Upvotes: 2

Views: 576

Answers (1)

Yuri Schimke
Yuri Schimke

Reputation: 13498

I couldn't get the filter working with stream/toplevel as described here https://developers.facebook.com/docs/graph-api/reference/v2.7/object/comments

Ideally you should be able to ask for ?filter=stream&order=chronological.

But you can definitely ask for comments of a specific comments.

$ fbapi '/v2.7/788239567865981_10153513872748291/comments' | jq -r '.data[] | [.id] | @tsv'
10153513872748291_10153513874383291
...
10153513872748291_10153513889623291

$ fbapi '/v2.7/10153513872748291_10153513888053291/comments' | jq -r '.data[] | [.id] | @tsv'
10153513872748291_10153513906423291
...
10153513872748291_10153514530053291

Upvotes: 0

Related Questions