# Reddit Post Comments (`datamagnet/reddit-comments-fetcher`) Actor

Fetch and organize comments from any Reddit post into a clean, easy-to-read list. Choose the comment order and return the main comment details in a simple table-like format.

- **URL**: https://apify.com/datamagnet/reddit-comments-fetcher.md
- **Developed by:** [Datamagnet](https://apify.com/datamagnet) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 60.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Reddit Comments Fetcher
Get the comments from any Reddit post in a clean, easy-to-read list.

### What it does
- Pulls the comments from the Reddit post you provide.
- Lets you choose how the comments are ordered, so you can see the newest, top, or most relevant ones first.
- Shows the main comment details in a simple table-like format.
- Can return just a few comments or more, depending on what you need.
- Keeps the output tidy and easy to scan.

### Use cases
- Check how people are reacting to a news story, product launch, or announcement in the comments.
- Review the top replies on a discussion thread to quickly understand the main opinions.
- Collect comment text, scores, and reply structure for research, moderation, or content analysis.

### Input
| Field | Description | Required | Example |
|---|---|---:|---|
| Reddit post URL | The full URL of the Reddit post you want comments from. | Yes | https://www.reddit.com/r/AskReddit/comments/ablzuq/people_who_have_been_to_prison_what_is_it_really/ |
| Sort order | Choose how the comments should be ordered. | Yes | new |
| Max results | Maximum number of comments to fetch. | No | 10 |

### Output
| Field | Description |
|---|---|
| all_awardings | Any awards attached to the comment. |
| approved_at_utc | When the comment was approved, in UTC, if available. |
| approved_by | The moderator or user who approved the comment, if available. |
| archived | Whether the comment is archived and no longer editable. |
| associated_award | The award linked to the comment, if any. |
| author | The username of the commenter. |
| author_flair_background_color | The background color of the author's flair, if set. |
| author_flair_css_class | The flair CSS class, if set. |
| author_flair_richtext | Rich text flair details for the author, if available. |
| author_flair_template_id | The flair template ID, if available. |
| author_flair_text | The text shown in the author's flair, if any. |
| author_flair_text_color | The text color used for the author's flair. |
| author_flair_type | The type of flair shown on the author profile. |
| author_fullname | The internal Reddit user ID for the author, if available. |
| author_is_blocked | Whether the author is blocked. |
| author_patreon_flair | Whether the author has a special supporter flair. |
| author_premium | Whether the author has premium status. |
| awarders | Users who gave awards to the comment. |
| banned_at_utc | When the comment was banned, in UTC, if available. |
| banned_by | The moderator or user who banned the comment, if available. |
| body | The full text of the comment. |
| body_html | The HTML version of the comment text. |
| can_gild | Whether the comment can receive gilding. |
| can_mod_post | Whether moderators can act on the comment. |
| collapsed | Whether the comment is collapsed. |
| collapsed_because_crowd_control | Whether crowd control caused the collapse. |
| collapsed_reason | The reason the comment is collapsed, if available. |
| collapsed_reason_code | A short code for why the comment is collapsed, if available. |
| comment_type | The type of comment, if available. |
| controversiality | A score showing how controversial the comment is. |
| created | The comment creation time as a Unix timestamp. |
| created_utc | The comment creation time in UTC as a Unix timestamp. |
| depth | How deep the comment is in the thread. |
| distinguished | Whether the comment is distinguished, such as by a moderator. |
| downs | The number of downvotes recorded for the comment. |
| edited | Whether the comment was edited after posting. |
| gilded | How many times the comment was gilded. |
| gildings | Details about any gildings on the comment. |
| id | The unique ID of the comment. |
| is_submitter | Whether the commenter is also the original post author. |
| likes | The user's like status for the comment, if available. |
| link_id | The ID of the Reddit post the comment belongs to. |
| locked | Whether the comment thread is locked. |
| mod_note | Any moderator note attached to the comment. |
| mod_reason_by | Who set the moderation reason, if available. |
| mod_reason_title | The title of the moderation reason, if available. |
| mod_reports | Any moderator reports on the comment. |
| name | The full Reddit name for the comment. |
| no_follow | Whether replies are disabled for the comment. |
| num_reports | The number of reports on the comment, if available. |
| parent_id | The ID of the parent comment or post. |
| permalink | The direct link to the comment. |
| removal_reason | The reason the comment was removed, if available. |
| report_reasons | The reasons the comment was reported, if available. |
| saved | Whether the comment was saved by the user. |
| score | The comment score. |
| score_hidden | Whether the score is hidden. |
| send_replies | Whether replies are enabled for the comment. |
| stickied | Whether the comment is pinned to the thread. |
| subreddit | The subreddit where the comment was posted. |
| subreddit_id | The internal ID of the subreddit. |
| subreddit_name_prefixed | The subreddit name with the r/ prefix. |
| subreddit_type | The type of subreddit, such as public. |
| top_awarded_type | The type of top award, if any. |
| total_awards_received | The total number of awards received. |
| treatment_tags | Any moderation treatment tags on the comment. |
| unrepliable_reason | The reason the comment cannot be replied to, if available. |
| ups | The number of upvotes recorded for the comment. |
| user_reports | Any user reports on the comment. |

### Sample output
```json
{
  "all_awardings": [],
  "approved_at_utc": null,
  "approved_by": null,
  "archived": true,
  "associated_award": null,
  "author": "HACKERB22015",
  "author_flair_background_color": null,
  "author_flair_css_class": null,
  "author_flair_richtext": [],
  "author_flair_template_id": null,
  "author_flair_text": null,
  "author_flair_text_color": null,
  "author_flair_type": "text",
  "author_fullname": "t2_7wta0av2",
  "author_is_blocked": false,
  "author_patreon_flair": false,
  "author_premium": false,
  "awarders": [],
  "banned_at_utc": null,
  "banned_by": null,
  "body": "WHAT I CAN COMMENT- WHAT THE FUUUUUUUUUUUUUUUUUUUUUUU",
  "body_html": "&lt;div class=\"md\"&gt;&lt;p&gt;WHAT I CAN COMMENT- WHAT THE FUUUUUUUUUUUUUUUUUUUUUUU&lt;/p&gt;\n&lt;/div&gt;",
  "can_gild": false,
  "can_mod_post": false,
  "collapsed": false,
  "collapsed_because_crowd_control": null,
  "collapsed_reason": null,
  "collapsed_reason_code": null,
  "comment_type": null,
  "controversiality": 0,
  "created": 1634330161,
  "created_utc": 1634330161,
  "depth": 0,
  "distinguished": null,
  "downs": 0,
  "edited": false,
  "gilded": 0,
  "gildings": {},
  "id": "hgs7jk8",
  "is_submitter": false,
  "likes": null,
  "link_id": "t3_ablzuq",
  "locked": false,
  "mod_note": null,
  "mod_reason_by": null,
  "mod_reason_title": null,
  "mod_reports": [],
  "name": "t1_hgs7jk8",
  "no_follow": false,
  "num_reports": null,
  "parent_id": "t3_ablzuq",
  "permalink": "/r/AskReddit/comments/ablzuq/people_who_havent_pooped_in_2019_yet_why_are_you/hgs7jk8/",
  "removal_reason": null,
  "report_reasons": null,
  "saved": false,
  "score": 4,
  "score_hidden": false,
  "send_replies": true,
  "stickied": false,
  "subreddit": "AskReddit",
  "subreddit_id": "t5_2qh1i",
  "subreddit_name_prefixed": "r/AskReddit",
  "subreddit_type": "public",
  "top_awarded_type": null,
  "total_awards_received": 0,
  "treatment_tags": [],
  "unrepliable_reason": null,
  "ups": 4,
  "user_reports": []
}
````

# Actor input Schema

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

How the comments should be ordered.

## `post_url` (type: `string`):

The full URL of the Reddit post you want comments from.

## `max_results` (type: `integer`):

Maximum number of comments to fetch.

## Actor input object example

```json
{
  "sort": "new",
  "post_url": "https://www.reddit.com/r/AskReddit/comments/ablzuq/people_who_have_been_to_prison_what_is_it_really/",
  "max_results": 10
}
```

# 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 = {
    "sort": "new",
    "post_url": "https://www.reddit.com/r/AskReddit/comments/ablzuq/people_who_have_been_to_prison_what_is_it_really/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamagnet/reddit-comments-fetcher").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 = {
    "sort": "new",
    "post_url": "https://www.reddit.com/r/AskReddit/comments/ablzuq/people_who_have_been_to_prison_what_is_it_really/",
}

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

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

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

```

## CLI example

```bash
echo '{
  "sort": "new",
  "post_url": "https://www.reddit.com/r/AskReddit/comments/ablzuq/people_who_have_been_to_prison_what_is_it_really/"
}' |
apify call datamagnet/reddit-comments-fetcher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamagnet/reddit-comments-fetcher",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Post Comments",
        "description": "Fetch and organize comments from any Reddit post into a clean, easy-to-read list. Choose the comment order and return the main comment details in a simple table-like format.",
        "version": "0.0",
        "x-build-id": "s9LmCqQdyrIngIZls"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamagnet~reddit-comments-fetcher/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamagnet-reddit-comments-fetcher",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamagnet~reddit-comments-fetcher/runs": {
            "post": {
                "operationId": "runs-sync-datamagnet-reddit-comments-fetcher",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamagnet~reddit-comments-fetcher/run-sync": {
            "post": {
                "operationId": "run-sync-datamagnet-reddit-comments-fetcher",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "post_url",
                    "sort"
                ],
                "properties": {
                    "sort": {
                        "title": "Sort order",
                        "enum": [
                            "confidence",
                            "top",
                            "new",
                            "controversial",
                            "old",
                            "qa"
                        ],
                        "type": "string",
                        "description": "How the comments should be ordered."
                    },
                    "post_url": {
                        "title": "Reddit post URL",
                        "type": "string",
                        "description": "The full URL of the Reddit post you want comments from."
                    },
                    "max_results": {
                        "title": "Max results",
                        "type": "integer",
                        "description": "Maximum number of comments to fetch.",
                        "default": 10
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
