Facebook Scraper Comment avatar
Facebook Scraper Comment

Pricing

Pay per event

Go to Apify Store
Facebook Scraper Comment

Facebook Scraper Comment

Developed by

Giichi Arai

Giichi Arai

Maintained by Community

Fast and reliable scraper for extracting comments from Facebook posts. Supports multiple output formats, pagination, and real-time data extraction. Perfect for social media monitoring, sentiment analysis, and research.

0.0 (0)

Pricing

Pay per event

0

3

3

Last modified

9 days ago

Facebook Scraper Comments – Fast API-powered Facebook Comments Extractor

Fast and reliable scraper for extracting comments from Facebook posts. Perfect for social media monitoring, sentiment analysis, and research.

Features

  • 🚀 Fast & Reliable: Built with high-performance API endpoints
  • 🔄 Pagination Support: Automatically handles pagination to get all comments
  • 📊 Multiple Output Formats: Export data as JSON, CSV, or Excel
  • 🎯 Precise Targeting: Get comments from specific Facebook posts using post IDs
  • 🔧 Flexible Configuration: Customize comment limits and output formats
  • 💾 Structured Data: Clean, formatted output with consistent field names
  • 🔍 Multi-Post Support: Process multiple post IDs in a single run

Input Parameters

Required Parameters

  • Post IDs (postIds): List of Facebook post IDs to extract comments from
    • Format: Array of strings containing Facebook post IDs
    • Example: ["691609893500456", "691609893500123"]
    • How to get post ID: From Facebook post URLs or API responses

Optional Parameters

  • Maximum Comments Per Post (maxCommentsPerPost): Maximum number of top-level comments to extract per post
    • Default: 25
    • Range: 1-2000
    • Important Note: The actual output may contain more items than this number because the API also returns replies to comments. This parameter only controls when to stop fetching new top-level comments.

Usage Examples

Basic Usage

{
"postIds": ["691609893500487"],
"maxCommentsPerPost": 25
}

Multiple Posts

{
"postIds": [
"691609893500487",
"1234567890123456",
"9876543210987654"
],
"maxCommentsPerPost": 50
}

Output sample

[
{
"id": "123456789_987654321",
"message": "Hello",
"created_time": "2025-06-22T06:02:35+0000",
"like_count": 18,
"comment_count": 3,
"from": {
"id": "100002001234567",
"name": "Alex",
"picture": {
"data": {
"height": 50,
"is_silhouette": false,
"url": "https://scontent.fsgn5-12.fna.fbcdn.net/v/t1.6435-1/example.jpg",
"width": 50
}
}
},
"parent": {
"id": "123456789_1199911111"
},
"is_reply": true,
"post_id": "987654321"
}
]

Note about output size: If you set maxCommentsPerPost to 25, you may actually receive 50+ items in the output because the API includes both top-level comments AND their replies. The parameter only controls when to stop fetching new top-level comments.

How It Works

  1. Post ID Processing: Each Facebook post ID is processed separately
  2. Comments Retrieval: Using the post ID, the actor fetches comments from the Facebook API
  3. Pagination: Automatically handles pagination to retrieve all requested comments
  4. Data Processing: Formats and structures the data consistently
  5. Data Storage: Saves results to Apify Dataset for easy export

Common Use Cases

  1. Sentiment Analysis: Analyze public reaction and sentiment in post comments
  2. Social Media Monitoring: Track engagement and responses to specific posts
  3. Market Research: Study customer feedback and opinions
  4. Content Analysis: Analyze conversation patterns and user engagement
  5. Brand Monitoring: Monitor comments on brand-related posts
  6. Community Management: Track discussions and user interactions

Getting Comments from Different Sources

From Facebook Post URLs

  • URL format: https://www.facebook.com/page/posts/POST_ID
  • Extract the POST_ID from the URL

From Facebook API Responses

  • Post IDs are typically included in API responses from other Facebook endpoints

From Browser Developer Tools

  • Right-click on Facebook post → "Inspect Element"
  • Look for post ID in data attributes or API calls

Technical Details

  • Runtime: Python 3.13
  • Dependencies: apify, httpx
  • Memory Usage: Optimized for large datasets
  • Concurrent Processing: Handles multiple posts efficiently
  • API Authentication: Uses X-API-Key header for secure access
  • Data Storage: Uses Apify Dataset for automatic format support

Rate Limiting & Performance

  • The actor implements intelligent rate limiting with exponential backoff
  • Automatic retry logic for failed requests
  • Pagination is handled automatically
  • Small delays between requests to respect API limits

Error Handling

The actor includes comprehensive error handling:

  • API request failures with retry logic
  • Network timeout handling
  • Data parsing error recovery
  • Graceful handling of posts with no comments

Note: This actor respects Facebook's terms of service and implements appropriate rate limiting. Always ensure you have permission to scrape the data you're accessing.