# X Comments Scraper (`coregent/x-comments-scraper`) Actor

Scrape public replies and comment threads from X (Twitter) posts by URL or ID: reply text, date, likes, views, author, parent and reply depth. Optional original-post details. No login, no cookies. Pay only for replies saved.

- **URL**: https://apify.com/coregent/x-comments-scraper.md
- **Developed by:** [Delowar Munna](https://apify.com/coregent) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 reply 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

## X Comments Scraper — Twitter Replies & Threads Export

![X Comments Scraper](https://raw.githubusercontent.com/coregentdevspace/x-comments-scraper-assets/main/thumbnail-x-comments-scraper.png)

Collect the **public replies under any X (Twitter) post**: reply text, date, likes, views, author and media, with the original post's details on every row. Paste post URLs or IDs, set a limit, and export clean rows to JSON, CSV or Excel.

No X login, no cookies, no browser and no proxy setup. You pay only for replies saved to your dataset.

### ✨ What it does

- 💬 **Replies from one post or a hundred** — paste X post URLs (x.com, twitter.com, mobile and `/i/status/` links all work) or numeric post IDs.
- 🧵 **Conversation context** — every reply carries the post it answers (`parent_id`), its `depth` and the conversation ID. Want the replies to a reply? Paste that reply's URL as a post.
- 📈 **Engagement on every reply** — likes, reposts, replies, quotes, bookmarks and views.
- 👤 **Author details** — username, display name, user ID, verified badge and avatar.
- 🔀 **Two reply orders** — X's default *Relevance* order, or *Latest first* for monitoring new replies.
- 🎯 **Filters** — date range, language, minimum likes, and an option to drop the post author's own replies.
- 📝 **Original post included** — the original post's author, text, date, likes, reply count and views on every reply row, at no extra cost.
- ♻️ **Repeat runs without paying twice** — pass reply IDs or URLs you already have and they are skipped and never charged.
- ⚖️ **Fair limits across posts** — posts are read in turns, one page each, so one huge thread can't use up the whole run.

### 🚀 Quick start

1. Paste one or more X post URLs into **Post URLs**.
2. Set **Maximum replies per post** (default 10) and **Maximum replies (total)**.
3. Click **Start**. Replies appear in the dataset as they are collected.

Run it with the defaults and you get up to 10 replies from the example post.

#### Example inputs

Replies from two posts, 10 each. This is the input behind the output preview below:

```json
{
    "postUrls": [
        "https://x.com/elonmusk/status/1808168603721650364",
        "https://x.com/elonmusk/status/1585841080431321088"
    ],
    "maxResultsPerSource": 10,
    "maxResults": 20,
    "sortBy": "relevance"
}
```

Newest replies from the last 30 days, including replies to replies:

```json
{
    "postUrls": ["https://x.com/elonmusk/status/1585841080431321088"],
    "maxResultsPerSource": 50,
    "sortBy": "latest",
    "since": "30 days"
}
```

### 📥 Input

| Field | What it does |
|---|---|
| `postUrls` | X post URLs whose replies you want. |
| `postIds` | Numeric post IDs, as an alternative to URLs. Duplicates across both lists are fetched once. |
| `maxResultsPerSource` | Stops each post after this many saved replies (default 10). |
| `maxResults` | Stops the whole run after this many saved replies (default 100). |
| `sortBy` | `relevance` (X's default order) or `latest` (newest first). |
| `since`, `until` | Only replies posted in this window. A date (`2026-11-01`) or a relative period (`7 days`). |
| `language` | Only replies in this language, as detected by X. |
| `minLikes` | Only replies with at least this many likes. |
| `excludeAuthorReplies` | Drop replies written by the original post's author. |
| `skipIds`, `skipUrls` | Replies you already have. Skipped and never charged. |
| `debug` | Saves the data provider's raw response for each post to the run's key-value store. For troubleshooting only. |

Filters are applied after replies are fetched, so a strict filter can mean more pages are read to fill your limit. Replies dropped by a filter are never charged.

### 📸 Output preview

A real run on two public posts, 10 replies each (the first input under **Example inputs**).

#### Overview

Reply text, date, author, likes, replies, views, depth, the post it answers, language and media type.

![Overview table view](https://raw.githubusercontent.com/coregentdevspace/x-comments-scraper-assets/main/x-comments-scraper-output-overview-table-view.png)

```json
{
    "reply_url": "https://x.com/Sassafrass_84/status/1808196108327199103",
    "text": "@elonmusk The legacy media is dead. https://t.co/hgxBDFk8bc",
    "created_at": "2024-07-02T17:48:41.000Z",
    "author_username": "Sassafrass_84",
    "like_count": 3778,
    "reply_count": 208,
    "view_count": 102430,
    "depth": 1,
    "parent_id": "1808168603721650364",
    "lang": "en",
    "media_type": "photo",
    "root_post_url": "https://x.com/elonmusk/status/1808168603721650364"
}
```

#### Engagement

Every engagement counter X shows on a reply, plus who it mentions.

![Engagement table view](https://raw.githubusercontent.com/coregentdevspace/x-comments-scraper-assets/main/x-comments-scraper-output-engagement-table-view.png)

```json
{
    "reply_url": "https://x.com/dankyoumyfriend/status/1585852430855864320",
    "author_username": "dankyoumyfriend",
    "created_at": "2022-10-28T04:34:17.000Z",
    "like_count": 11742,
    "retweet_count": 176,
    "reply_count": 3013,
    "quote_count": 99,
    "bookmark_count": 37,
    "view_count": null,
    "mentions": "WatcherGuru, elonmusk"
}
```

#### Authors

Who replied: avatar, username, name, verified badge and user ID.

![Authors table view](https://raw.githubusercontent.com/coregentdevspace/x-comments-scraper-assets/main/x-comments-scraper-output-authors-table-view.png)

```json
{
    "author_avatar_url": "https://pbs.twimg.com/profile_images/1463062461934931969/2VtwipQQ_normal.jpg",
    "author_username": "WarClandestine",
    "author_name": "Clandestine",
    "author_verified": true,
    "author_id": "1313536464022646786",
    "reply_url": "https://x.com/WarClandestine/status/1808170286425964893"
}
```

#### Original post

The post being replied to, on every row: author, text, date, likes, replies and views.

![Original post table view](https://raw.githubusercontent.com/coregentdevspace/x-comments-scraper-assets/main/x-comments-scraper-output-original-post-table-view.png)

```json
{
    "root_post_url": "https://x.com/elonmusk/status/1585841080431321088",
    "root_post_author_username": "elonmusk",
    "root_post_text": "the bird is freed",
    "root_post_created_at": "2022-10-28T03:49:11.000Z",
    "root_post_like_count": 2158277,
    "root_post_reply_count": 120877,
    "root_post_view_count": null,
    "reply_url": "https://x.com/WatcherGuru/status/1585841941203537920",
    "text": "@elonmusk https://t.co/cXyT9c9Swc"
}
```

### 📤 Output

One row per unique reply. Missing values are `null`, never guessed. A full record with every field:

```json
{
    "recordType": "reply",
    "reply_id": "1808170286425964893",
    "reply_url": "https://x.com/WarClandestine/status/1808170286425964893",
    "root_post_id": "1808168603721650364",
    "root_post_url": "https://x.com/elonmusk/status/1808168603721650364",
    "parent_id": "1808168603721650364",
    "depth": 1,
    "conversation_id": "1808168603721650364",
    "text": "@elonmusk Translation:\n\n“We cannot control the narrative anymore!”",
    "created_at": "2024-07-02T16:06:05.000Z",
    "lang": "en",
    "like_count": 8443,
    "retweet_count": 391,
    "reply_count": 112,
    "quote_count": 5,
    "bookmark_count": 87,
    "view_count": 909235,
    "hashtags": null,
    "mentions": "elonmusk",
    "urls": null,
    "media_type": "none",
    "media_urls": null,
    "video_url": null,
    "is_sensitive": null,
    "author_id": "1313536464022646786",
    "author_username": "WarClandestine",
    "author_name": "Clandestine",
    "author_verified": true,
    "author_avatar_url": "https://pbs.twimg.com/profile_images/1463062461934931969/2VtwipQQ_normal.jpg",
    "root_post_author_username": "elonmusk",
    "root_post_text": "The New York Times is attacking *your* freedom of speech! https://t.co/TRIa13TWdY",
    "root_post_created_at": "2024-07-02T15:59:23.000Z",
    "root_post_like_count": 281227,
    "root_post_reply_count": 18424,
    "root_post_view_count": 53722484,
    "source_input": "https://x.com/elonmusk/status/1808168603721650364",
    "sort_order": "relevance",
    "provider": "tikhub",
    "scraped_at": "2026-11-20T13:25:09.657Z"
}
```

- **Relevance** order returns the **direct replies** to each post you give (`depth` 1, `parent_id` = that post). To go one level deeper, paste a reply's URL as a post.
- **Latest first** returns the whole conversation newest first, including replies to replies. Every row has the real `parent_id`; `depth` is 1 for direct replies and `null` for deeper ones.
- `hashtags`, `urls`, `media_*`, `video_url` and `is_sensitive` are `null` when the reply has none or X doesn't say.
- `view_count` is `null` on posts from before X started counting views (late 2022).
- Dataset views: **Overview**, **Engagement**, **Authors** and **Original post**.

#### Run summary

Each run also writes a `RUN_SUMMARY` record to the key-value store, kept out of the dataset: inputs given, valid and invalid entries, pages fetched, replies saved, duplicates removed, replies skipped and filtered, failed posts with a reason (for example "the post may not exist, be deleted, or be from a protected account"), and why the run stopped.

### 💰 Pricing

Pay per event:

- **Reply result**: charged once per unique reply saved to the dataset. The original post's details on each row are included.

Not charged: duplicates, replies dropped by filters or skip lists, failed posts, and the run summary. A run that saves nothing costs nothing in events. You can set a maximum cost per run in Apify, and the run stops cleanly when it's reached.

See the **Pricing** tab for current rates. This README deliberately doesn't quote figures, because prices can change.

### 🔁 Monitor replies on a schedule

To collect only new replies on a post or campaign:

1. Set **Reply order** to *Latest first* and **Replies posted after** to a relative period such as `1 day`.
2. Save the input as a task and schedule it daily in Apify.
3. Optionally, pass the reply IDs from earlier runs in **Reply IDs to skip**, so they are never charged again.

### ⚠️ Limitations

- Only **public** replies are returned. Replies on protected accounts, deleted posts and replies X hides from logged-out viewers aren't available.
- X decides which replies it shows and in what order, so very large threads may not be returned in full.
- Filters run after fetching. X doesn't filter replies for us.
- In Relevance order a run returns one level, the direct replies to each post you give. Use Latest first, or a reply's URL as input, for replies to replies.
- Author follower counts and bios aren't available from this source, so they aren't in the output.

### 🔒 Privacy and disclaimer

This is an unofficial, independent Actor, not affiliated with or endorsed by X Corp. It processes only publicly accessible information. You are responsible for using the data in line with applicable law (including data protection rules such as GDPR), X's terms and Apify's policies. Don't use it to collect sensitive personal data.

### 🔗 Integrations

Use it from the Apify Console, the Apify API, scheduled tasks, webhooks, Make, Zapier, n8n, or any tool that reads Apify datasets. To collect posts themselves by keyword, hashtag or profile, see [X Tweet Scraper](https://apify.com/coregent/x-tweet-scraper).

### ❓ Troubleshooting

- **A post returns no replies**: check that the post is public and still online, and that it has replies.
- **Fewer replies than the limit**: X may show fewer replies to logged-out viewers, or your filters dropped some (see `RUN_SUMMARY.filtered_out`).
- **"Unusable entry"**: the entry isn't an X post URL (it needs `…/status/<id>`) or a numeric ID.

### 📝 Changelog

- **0.1** — first release: replies by post URL or ID, relevance or latest order, filters, skip lists, original post details on every row.

# Actor input Schema

## `postUrls` (type: `array`):

X (Twitter) post URLs whose replies you want, one per entry (e.g. <code>https://x.com/nasa/status/1234567890123456789</code>). twitter.com, mobile and /i/status/ links work too.

## `postIds` (type: `array`):

Numeric X post IDs, as an alternative to URLs (e.g. <code>1234567890123456789</code>). Duplicates across both lists are fetched once.

## `maxResultsPerSource` (type: `integer`):

Stops each post after this many saved replies.

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

Stops the whole run after this many saved replies, across all posts. Posts are read in turns, one page each, so one big thread can't use up the whole limit.

## `sortBy` (type: `string`):

<b>Relevance</b> is X's default reply order (top replies first). <b>Latest</b> returns the newest replies first; use it with "Replies posted after" to collect only new replies on a schedule.

## `since` (type: `string`):

Only replies posted on or after this date (UTC), or within a relative period before the run, such as <code>7 days</code>.

## `until` (type: `string`):

Only replies posted before this date (UTC, not included), or before a relative period ago, such as <code>1 day</code>.

## `language` (type: `string`):

Only replies in this language, as detected by X.

## `minLikes` (type: `integer`):

Only replies with at least this many likes. 0 = no minimum.

## `excludeAuthorReplies` (type: `boolean`):

Drop replies written by the author of the original post (for example a thread they continued themselves).

## `skipIds` (type: `array`):

Reply IDs you already have. They are left out and never charged, so a repeat run only returns new replies.

## `skipUrls` (type: `array`):

Reply URLs you already have, as an alternative to IDs.

## `debug` (type: `boolean`):

Saves the data provider's raw response for each post to the run's key-value store (DEBUG_RAW_PAGE\_\<post ID>). For troubleshooting only.

## Actor input object example

```json
{
  "postUrls": [
    "https://x.com/elonmusk/status/1808168603721650364"
  ],
  "postIds": [],
  "maxResultsPerSource": 10,
  "maxResults": 100,
  "sortBy": "relevance",
  "language": "any",
  "minLikes": 0,
  "excludeAuthorReplies": false,
  "skipIds": [],
  "skipUrls": [],
  "debug": false
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# 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 = {
    "postUrls": [
        "https://x.com/elonmusk/status/1808168603721650364"
    ],
    "maxResultsPerSource": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("coregent/x-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 = {
    "postUrls": ["https://x.com/elonmusk/status/1808168603721650364"],
    "maxResultsPerSource": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("coregent/x-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 '{
  "postUrls": [
    "https://x.com/elonmusk/status/1808168603721650364"
  ],
  "maxResultsPerSource": 10
}' |
apify call coregent/x-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,coregent/x-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/mUYayhKe2L4qFAOVe/builds/gNZoEj9X9lcU0oNYC/openapi.json
