Apify example task · whoareyouanas/facebook-single-post-scraper

Collect a sample of comments from a Facebook post

Look up one public Facebook post and request up to five visible comments. Review comment text with the associated post and available engagement counts.

Actor
Facebook Post Scraper by ID: Text, Comments and Reactions
Result limit
Set by the input
Estimated cost
Per result, see pricing
Run options
Actor defaults

Example updated 2026-11-20 · actor build 0.1.13 · runs in your own Apify account

01 / About the actor

Facebook Post Scraper by ID: Text, Comments and Reactions

Retrieve known Facebook posts by numeric ID with text, authors, engagement, media links, and optional loaded comments. Use per-post statuses to separate complete results from partial or inaccessible content.

Batch known post IDs

Submit numeric identifiers as quoted strings to preserve precision.

HTTP with optional fallback

Try the documented HTTP workflow and use browser fallback when enabled and needed.

Inspect each result

Keep extraction method, missing fields, status, and errors alongside the post.

02 / Input

The exact input this example runs.

postIds is required and accepts numeric strings of 5–40 digits. Full URLs and opaque pfbid identifiers are not accepted. Enable comments and browserFallback only when needed, and review their cost implications.

input.json · facebook-post-comments-sample
{
  "maxConcurrency": 1,
  "browserConcurrency": 1,
  "postIds": [
    "4376904415959558"
  ],
  "includeMedia": false,
  "includeComments": true,
  "maxComments": 5
}
Input fields used by this example, their values and what they control
FieldValue in this exampleWhat it controls
maxConcurrency1Maximum posts in flight. Lower this when Facebook throttles requests.
browserConcurrency1Maximum fallback tabs in the shared browser.
postIdsChange this4376904415959558Required: numeric Facebook post IDs as quoted strings, for example ["4376904415959558"]. For a /groups/GROUP_ID/permalink/POST_ID/ URL, use POST_ID. URLs, group IDs, and pfbid identifiers are not accepted. Duplicates produce one row.
includeMediaChange thisfalseReturn image and video URLs without downloading the files.
includeCommentsChange thistrueReturn comments present in the post response, up to maxComments. Does not paginate or promise all comments.
maxCommentsChange this5Limit per post, applied after deduplication.
Other inputs you can add (5)
Deployed actor input fields, types, defaults, and descriptions
FieldType / requiredDefaultPurpose
httpTimeoutSecsinteger12Maximum time per HTTP attempt.

Minimum: 1 · Maximum: 120

browserTimeoutSecsinteger30Maximum time per fallback page after browser startup and queue wait.

Minimum: 1 · Maximum: 120

maxRetriesinteger1Retries for transient network errors, throttling, and server errors.

Minimum: 0 · Maximum: 3

browserFallbackbooleantrueUse a browser when HTTP does not expose complete data. Successful browser results cost $0.04 instead of $0.005 for HTTP results. Disable for HTTP-only pricing.
proxyConfigurationobject{"useApifyProxy":true,"apifyProxyGroups":["RESIDENTIAL"],"apifyProxyCountry":"IN"}Residential Apify Proxy is enabled by default for cloud runs, using runtime credentials. Built-in proxy usage is included in Actor event pricing. Datacenter IPs may receive Facebook login restrictions. Disable explicitly for direct requests. The tested default country is India (IN); you can select another region.

03 / Make it yours

Change these fields for your own research.

  1. 01 · postIds

    Post IDs

    Required: numeric Facebook post IDs as quoted strings, for example ["4376904415959558"]. For a /groups/GROUP_ID/permalink/POST_ID/ URL, use POST_ID. URLs, group IDs, and pfbid identifiers are not accepted. Duplicates produce one row.

    Example: 4376904415959558

  2. 02 · includeMedia

    Include media URLs

    Return image and video URLs without downloading the files.

    Example: false

  3. 03 · includeComments

    Include loaded comments

    Return comments present in the post response, up to maxComments. Does not paginate or promise all comments.

    Example: true

  4. 04 · maxComments

    Maximum loaded comments

    Limit per post, applied after deduplication.

    Example: 5

Run it in three steps

  1. Open the example on Apify and select Try for free to copy it into your Apify account.
  2. Replace the sample values above with your own target and keep the limit small.
  3. Start the run, then export the dataset as JSON, CSV or Excel.

04 / Output

What the results table shows.

Columns in the “Posts” view

inputPostId

Requested ID

status

Status

post.postUrl

Post

post.authorName

Author

post.text

Text

post.timestamp

Published

post.totalReactions

Reactions

post.commentsCount

Comments

post.sharesCount

Shares

extractionMethod

Method

durationMs

Duration (ms)

error

Error

A view selects columns for the table. The full JSON export keeps every field, including nested arrays and objects.

05 / Cost

What this example costs to run.

Charges follow the billable events in the pricing table below and the number of records the run returns. This example has no single total result cap, so start with it as is and check the run's charges before widening it.

Prices checked 2026-11-22. Set a run spending limit in Apify when you widen the input.

06 / API

Run the same input from your code.

This call starts a billable run of Facebook Post Scraper by ID: Text, Comments and Reactions with this example's input and returns the dataset items when it finishes. Synchronous calls wait up to five minutes; for longer runs, POST to /runs instead and read the run's default dataset when it succeeds. Keep the token in an environment variable.

cURL · run and return the results
curl --request POST \
  'https://api.apify.com/v2/acts/whoareyouanas~facebook-single-post-scraper/run-sync-get-dataset-items?format=json' \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"maxConcurrency":1,"browserConcurrency":1,"postIds":["4376904415959558"],"includeMedia":false,"includeComments":true,"maxComments":5}'

Coverage & interpretation

Check the result before relying on it.

Questions

About this example.

What does the "Collect a sample of comments from a Facebook post" example collect?

Look up one public Facebook post and request up to five visible comments. Review comment text with the associated post and available engagement counts. It runs Facebook Post Scraper by ID: Text, Comments and Reactions, published by whoareyouanas on Apify.

Which input does this example use?

Post IDs (postIds) set to 4376904415959558; Include media URLs (includeMedia) set to false; Include loaded comments (includeComments) set to true; Maximum loaded comments (maxComments) set to 5. The full JSON input is shown on this page.

How much does it cost to run this example?

Charges follow the billable events in the pricing table below and the number of records the run returns. This example has no single total result cap, so start with it as is and check the run's charges before widening it.

How do I change it for my own research?

Open the example on Apify and select Try for free to copy it into your account, then edit Post IDs, Include media URLs, Include loaded comments, Maximum loaded comments. Keep the result limit small for the first run and check the output before scaling up.

Can I run it from the API or on a schedule?

Yes. Send the same JSON input to the Facebook Post Scraper by ID: Text, Comments and Reactions run endpoint with your Apify API token, or save the copied task in your Apify account and add a schedule. Results land in the run's default dataset as JSON, CSV or Excel.

More examples

Related tasks you can copy.

Guides

Read more about this workflow.