Retrieve comments
Collect comments
When a scraping job is executed with the get_comments
parameter set to true
,
all publicly available (non-deleted) comments for the specified post will be
collected. You can retrieve these comments, along with any replies, using the
following endpoint. We return up to 1000 comments per post.
To retrieve comments, you’ll need to use the post_id
associated with
the target Facebook post. This value is provided in the scraping results.
Base URL
GET https://facebook-scraper-api.datashake.com/v1/scrape/:request_id/comments
Path parameters
request_id
Field type: string
Required: true
Description: The unique identifier for the scraping request.
Request parameters
post_id
Field type: string
Required: true
Description: The unique identifier for the Facebook post.
page
Field type: integer
Required: false
Description: The page number of the results to retrieve.
per_page
Field type: integer
Required: false
Description: The number of results to retrieve per page.
Code example
curl --location 'https://facebook-scraper-api.datashake.com/v1/scrape/1742515679047322765-7538bd54-2bd7-45/comments?post_id=1217775029913484&page=1&per_page=10' --header 'x-api-key: your-api-key'
import requests
url = "https://facebook-scraper-api.datashake.com/v1/scrape/1742515679047322765-7538bd54-2bd7-45/comments"
params = {
"post_id": "1217775029913484",
"page": 1,
"per_page": 10
}
headers = {
"x-api-key": "your-api-key"
}
response = requests.get(url=url, headers=headers, params=params)
Response
API response example
{
"request_id":"1743405732704235622-3e02dd3d-6b32-49",
"status":"completed",
"credits_used":null,
"request_metadata": {
"url": "https://www.facebook.com/humansofnewyork/posts/1217775029913484",
"callback_url": "http://example.com/callback",
"external_identifier": "my-custom-id",
"get_comments": true
},
"results":[
{
"post_id":"1217775029913484",
"post_url":"https://www.facebook.com/humansofnewyork/posts/1217775029913484",
"comment_id":"Y29tbWVudDoxMjE3Nzc1MDI5OTEzNDg0XzEwMDEzMTcwMjE1MTE1Mzc=",
"posted_at": "2025-03-31T16:49:15.000Z",
"text":"I attract healthy love. I’m enough.” I wish that every teen girl and young woman could feel this in their bones. Everybody, really.",
"replies_count": 4,
"likes_count":734,
"author": {
"profile_picture_url": null,
"name": "Peg Fury",
"url": null,
"id": "pfbid02KRioXsb7cyz2dmtSTaFivPjakJFBM343TZB1Z9sTH1Ju2jN8Ns6jJEDYsigaBf99l"
},
"replies":[
{
"post_url":"https://www.facebook.com/humansofnewyork/posts/1217775029913484",
"author": {
"profile_picture_url": null,
"name": "Frances Delgado",
"url": null,
"id": "pfbid0eKyRbUWz2Wz3A2c4XUsUnJQ1H6mLoe1FTAU9KELZxZGYg4ndGy6gp6N77dfzn8t6l"
},
"text":"Peg Fury Send Mrs Susan pena a friend request you'll definitely thank me later for referring you to her!\n👇👇👇\nSusan Pena",
"comment_id":"Y29tbWVudDoxMjE3Nzc1MDI5OTEzNDg0XzEwMDEzMTcwMjE1MTE1Mzc=",
"reply_id":"Y29tbWVudDoxMjE3Nzc1MDI5OTEzNDg0Xzk2NzU1NzQwMjI1MTg5NA==",
"likes_count":0,
"posted_at": "2025-03-31T20:05:48.000Z"
},
{
"post_url":"https://www.facebook.com/humansofnewyork/posts/1217775029913484",
"author": {
"profile_picture_url": null,
"name": "Barbi Petty",
"url": null,
"id": "pfbid0kcxGvnqndzgSprTje2k4wSykNgmSTtjWoWdvPtzfUDGhWEhc9ktfAEZzSMHei8iql"
},
"text":"Peg Fury facts",
"comment_id":"Y29tbWVudDoxMjE3Nzc1MDI5OTEzNDg0XzEwMDEzMTcwMjE1MTE1Mzc=",
"reply_id":"Y29tbWVudDoxMjE3Nzc1MDI5OTEzNDg0XzEyMTE0NDMwOTA1NTA0MzA=",
"likes_count":0,
"posted_at":"2025-03-31T20:05:48.000Z",
},
...
]
},
...
],
"summary":null,
"pagination":{
"total":878,
"page":1,
"per_page":10,
"total_pages":88
}
}