# Reddit Comments Scraper (`igview-owner/reddit-comments-scraper`) Actor

Fast and reliable tool to search, extract, and download Reddit comments by keyword, subreddit, or author. No login required. Export to JSON/CSV.

- **URL**: https://apify.com/igview-owner/reddit-comments-scraper.md
- **Developed by:** [Sachin Kumar Yadav](https://apify.com/igview-owner) (community)
- **Categories:** Developer tools, Social media, Automation
- **Features:** Limited permissions
- **Stats:** 13 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 💬 Reddit Comments Scraper - Extract Comments & Discussions

[![Apify](https://img.shields.io/badge/Apify-Actor-orange)](https://apify.com)
[![Reddit](https://img.shields.io/badge/Reddit-Supported-FF4500)](https://reddit.com)

**Extract Reddit comments from subreddit streams with rich metadata, pagination, and advanced filtering. Perfect for sentiment analysis, market research, and content monitoring!**

### 📋 Table of Contents

- [🚀 Features](#-features)
- [🎯 Use Cases](#-use-cases)
- [⚡ Quick Start](#-quick-start)
- [📊 Input Parameters](#-input-parameters)
- [📤 Output Format](#-output-format)
- [🔧 Configuration](#-configuration)
- [📈 Performance](#-performance)
- [❓ FAQ](#-faq)
- [🛠️ Troubleshooting](#️-troubleshooting)
- [📞 Support](#-support)

### 🚀 Features

#### 💬 **Comment Extraction Capabilities**

- ✅ **Subreddit Streams** - Scrape live comment feeds from any subreddit
- ✅ **Pagination Support** - Extract multiple pages with automatic cursor management
- ✅ **Batch Processing** - Efficient data extraction with structured output

#### 📊 **Rich Metadata Extraction**

- ✅ **Comment Details** - Author, content, scores, timestamps, permalinks
- ✅ **Linked Post Information** - Linked post title, subreddit, post ID, and link details
- ✅ **User Data** - Author names, flair information, and user status
- ✅ **Engagement Metrics** - Upvotes, downvotes, comment scores, and rankings
- ✅ **Thread Structure** - Parent-child relationships and reply hierarchies

#### 🔄 **Advanced Features**

- ✅ **Real-time Scraping** - Get the latest comments as they're posted
- ✅ **Cursor Pagination** - Resume scraping from specific positions
- ✅ **Error Handling** - Robust retry logic and comprehensive error reporting
- ✅ **Rate Limiting** - Respectful API usage with built-in delays

### 🎯 Use Cases

| Use Case | Description | Benefits |
|----------|-------------|----------|
| 📈 **Sentiment Analysis** | Analyze public opinion on products, brands, or topics | Track brand sentiment, identify trends, measure public reaction |
|  **Market Research** | Monitor discussions about competitors and industry trends | Competitive intelligence, product feedback, market insights |
|  **Content Monitoring** | Track mentions and discussions across subreddits | Brand monitoring, crisis management, engagement tracking |
|  **Academic Research** | Collect data for social media and communication studies | Large-scale data collection, discourse analysis, behavioral studies |
| 🤖 **AI Training Data** | Gather conversational data for chatbots and NLP models | Training datasets, conversation patterns, language modeling |
| 📊 **Social Listening** | Monitor community discussions and emerging topics | Trend identification, community insights, viral content tracking |

### ⚡ Quick Start

#### 1️⃣ **Scrape Subreddit Comment Stream**

```json
{
  "subreddit": "technology",
  "maxPages": 5
}
```

#### 2️⃣ **Advanced Pagination**

```json
{
  "subreddit": "AskReddit",
  "maxPages": 10
}
```

### 📊 Input Parameters

| Parameter | Type | Required | Description | Example |
|-----------|------|----------|-------------|---------|
| `subreddit` | String | ✅ | Subreddit name (without r/) | `"technology"`, `"AskReddit"`, `"gaming"` |
| `maxPages` | Integer | ❌ | Pages to scrape (1-50) | `5` (default: 1) |

#### 🏷️ **Popular Subreddits**

| Category | Subreddits | Description |
|----------|------------|-------------|
| 🎮 **Gaming** | gaming, pcmasterrace, nintendo | Gaming discussions and news |
| 💼 **Business** | entrepreneur, investing, stocks | Business and finance topics |
| 🔬 **Technology** | technology, programming, apple | Tech news and discussions |
| 🎭 **Entertainment** | movies, television, music | Entertainment content |
| 📰 **News** | worldnews, news, politics | Current events and politics |
| 🎨 **Creative** | art, photography, design | Creative content and feedback |

### 📤 Output Format

#### 💬 **Comment Data Structure**

```json
{
  "type": "comments_batch",
  "comments": [
    {
      "comment_id": "abc123",
      "author": "username",
      "content": "This is a comment...",
      "score": 42,
      "created_utc": 1640995200,
      "depth": 0,
      "parent_id": null,
      "subreddit": "funny",
      "post_title": "Amazing post title",
      "post_id": "xyz789",
      "permalink": "/r/funny/comments/xyz789/title/abc123/"
    }
  ],
  "batch_number": 1,
  "total_batches": 3
}
```

#### � **Summary Data Structure**

```json
{
  "type": "scraping_summary",
  "mode": "subreddit_comments",
  "subreddit": "technology",
  "total_comments_scraped": 250,
  "total_requests_made": 5,
  "pages_scraped": 5,
  "completed_at": "2024-01-01T12:00:00.000Z",
  "success": true
}
```

### 🔧 Configuration

#### 📄 **Pagination Settings**

| Pages | Comments | Use Case | Processing Time |
|-------|----------|----------|-----------------|
| 1-3 | 50-150 | Quick sampling | 1-2 minutes |
| 4-10 | 200-500 | Medium research | 3-5 minutes |
| 11-25 | 500-1250 | Large datasets | 8-15 minutes |
| 26-50 | 1250-2500 | Comprehensive analysis | 15-30 minutes |

#### 🎯 **Scraping Modes**

| Mode | Description | Best For |
|------|-------------|----------|
| **Subreddit Stream** | Extract live comments from a subreddit | Community monitoring, trend tracking |

### 📈 Performance

#### ⚡ **Speed Metrics**

- **Processing Time**: ~1-2 seconds per page
- **Comments per Page**: 25-50 comments typically
- **API Response**: Sub-second response times
- **Batch Processing**: Efficient data chunking

#### 🔄 **Reliability Features**

- **Automatic Retry Logic** - Handles temporary API failures
- **Rate Limiting** - Respectful 1-second delays between requests
- **Error Recovery** - Continues processing despite individual failures
- **Cursor Management** - Automatic pagination handling

#### 📊 **Data Quality**

- **Complete Metadata** - All available comment fields extracted
- **Nested Structure** - Preserves reply hierarchies and thread depth
- **Timestamp Accuracy** - UTC timestamps for precise timing
- **Content Integrity** - Raw comment text without modifications

### ❓ FAQ

#### **Q: What types of Reddit content can I scrape?**

**A:** You can scrape:

- Live comment streams from any public subreddit
- Comment metadata including scores, timestamps, and author info

#### **Q: How many comments can I extract?**

**A:** This depends on your configuration:

- **Subreddit Stream**: 25-50 comments per page, up to 50 pages (1250-2500 comments)

#### **Q: Does this work with private subreddits?**

**A:** No, this scraper only works with public subreddits and posts that are accessible without authentication.

#### **Q: How do I handle large datasets?**

**A:** The scraper automatically:

- Chunks data into manageable batches
- Provides pagination cursors for continuation
- Includes progress tracking and summaries

#### **Q: What about Reddit's rate limits?**

**A:** The scraper includes:

- Built-in 1-second delays between requests
- Automatic retry logic for failed requests
- Respectful API usage patterns

#### **Q: Can I resume interrupted scraping?**

**A:** Yes! Use the `startCursor` parameter with the cursor value from your previous run to continue where you left off.

### 🛠️ Troubleshooting

#### 🚨 **Common Issues**

| Issue | Cause | Solution |
|-------|-------|----------|
| "Subreddit not found" | Private/banned subreddit | Check subreddit exists and is public |
| "No comments found" | Empty subreddit / low activity | Verify content exists, try different subreddit |
| "Request timeout" | Network issues | Retry the scraping, check internet connection |

#### 🔍 **Debug Tips**

1. **Test URLs** - Verify Reddit URLs work in browser first
2. **Start Small** - Begin with 1-2 pages before scaling up
3. **Check Logs** - Review actor run logs for detailed error messages
4. **Validate Subreddits** - Ensure subreddit names are correct (no r/ prefix)

#### ⚠️ **Best Practices**

- Use reasonable page limits to avoid timeouts
- Monitor your Apify usage to stay within plan limits
- Respect Reddit's content policies and terms of service
- Consider data privacy when processing user-generated content

### 📞 Support

#### 🆘 **Need Help?**

- 📧 **Issues**: Report bugs and feature requests through Apify Console
- 💬 **Community**: Join Apify Discord for community support
- 📖 **Documentation**: Comprehensive guides in Apify Docs
- 🎯 **Best Practices**: Optimization tips for large-scale scraping

#### 🔗 **Related Actor**

- [Reddit User Data Scraper](https://apify.com/igview-owner/reddit-user-data-scraper)
- [Reddit Search Scraper](https://apify.com/igview-owner/reddit-search-scraper)
- [Reddit Post Viewer](https://apify.com/igview-owner/reddit-post-viewer)

***

### 🏷️ **Keywords & Tags**

`reddit scraper`, `reddit comments extractor`, `reddit api`, `comment scraping`, `subreddit scraper`, `reddit data extraction`, `social media scraping`, `reddit sentiment analysis`, `reddit monitoring`, `reddit research tool`, `reddit comment analysis`, `reddit thread scraper`, `reddit discussion extractor`, `reddit apify actor`, `reddit automation`, `reddit data mining`, `reddit content scraper`, `reddit post scraper`, `reddit comment harvester`, `reddit social listening`

***

**⭐ Star this actor if it helps you extract Reddit data efficiently!**

*Built with ❤️ using Apify Platform - Powerful Reddit data extraction made simple*

# Actor input Schema

## `searchQuery` (type: `string`):

🏷️ Search keyword or phrase to find in comment body (case-insensitive). Example: science, artificial intelligence, python programming

## `subreddit` (type: `string`):

🏷️ Filter by subreddit name (without r/). Example: AskReddit, funny, technology, worldnews

## `author` (type: `string`):

🏷️ Filter by Reddit username (without u/). Example: spez, AutoModerator

## `after` (type: `integer`):

⏰ Get comments made AFTER this many days ago. Example: Enter 30 to get comments from last 30 days.

## `before` (type: `integer`):

⏰ Get comments made BEFORE this many days ago. Example: Enter 1 to only get comments older than 1 day.

## `sort` (type: `string`):

📊 Sort results by creation time. 'desc' = newest first (default), 'asc' = oldest first

## `maxResults` (type: `integer`):

🔢 Total number of comments to fetch (1-1000). Results are fetched in batches of 100. More results = longer processing time.

## Actor input object example

```json
{
  "searchQuery": "quantum computing",
  "subreddit": "",
  "author": "",
  "sort": "desc",
  "maxResults": 100
}
```

# Actor output Schema

## `comments` (type: `string`):

View all comments with author, content, score, timestamp, subreddit, and permalink.

## `detailed` (type: `string`):

View all comment data including parent ID, link ID, subreddit ID, author flair, and batch number.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQuery": "quantum computing",
    "subreddit": "",
    "author": "",
    "sort": "desc",
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("igview-owner/reddit-comments-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQuery": "quantum computing",
    "subreddit": "",
    "author": "",
    "sort": "desc",
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("igview-owner/reddit-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQuery": "quantum computing",
  "subreddit": "",
  "author": "",
  "sort": "desc",
  "maxResults": 100
}' |
apify call igview-owner/reddit-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,igview-owner/reddit-comments-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Wq6gD9KpCdRmwaRUi/builds/4QCTN5JBUQKAthB18/openapi.json
