# X (Twitter) Comments Scraper - Export Tweet Replies (`vulnv/twitter-comments-scraper`) Actor

Scrape comments and replies from any X (Twitter) post. Export the reply text, author profile, likes, retweets, reply and view counts to JSON, CSV or Excel. No login or cookies needed.

- **URL**: https://apify.com/vulnv/twitter-comments-scraper.md
- **Developed by:** [VulnV](https://apify.com/vulnv) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 1,000 comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## X (Twitter) Comments Scraper - Export Tweet Replies to JSON, CSV & Excel

**Scrape comments and replies from any X (Twitter) post by URL or tweet ID.** For every reply you get one structured row with the full comment text, the author's profile, and engagement metrics (likes, retweets, replies, quotes, bookmarks and views). Export to JSON, CSV or Excel, or pull it through the Apify API.

No login, no cookies, no API keys and nothing to configure - just paste tweet URLs and press **Start**.

> **Unofficial notice:** This is an independent tool and is **not** affiliated with, endorsed by, or connected to X, Twitter or X Corp. "X" and "Twitter" are trademarks of their respective owners, used here only to describe what the Actor scrapes.

### What this X (Twitter) Comments Scraper does

- **Scrape replies from any tweet** - supply X/Twitter post URLs (`https://x.com/user/status/123...`) or bare tweet IDs.
- **Scrape many posts in one run** - each post is paginated independently; duplicates are removed automatically.
- **Full comment text** - both the raw text and the display text (with leading @mentions trimmed).
- **Complete author profile** - name, @handle, bio, follower count, blue (Premium) verification and avatar.
- **All engagement metrics** - likes, retweets, replies, quotes, bookmarks and view counts per comment.
- **Rich detail** - @mentions, attached media URLs, language, timestamps and conversation id.

Every result is one row with the important fields flattened to the top level (readable table view) plus the full nested `author`, `entities` and `media` objects.

### How to scrape X (Twitter) comments (step by step)

1. Paste one or more tweet URLs or IDs into **Tweet URLs or IDs**.
2. Set **Maximum comments per post** (default 100, or 0 for all available).
3. Press **Start**. Export the dataset as JSON, CSV, Excel, XML or via the API.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `postUrls` | array | **Required.** X (Twitter) post URLs or tweet IDs. |
| `maxCommentsPerPost` | integer | Comments to fetch per post. `0` = all available. Default `100`. |

#### Example input

```json
{
  "postUrls": [
    "https://x.com/elonmusk/status/1849867576720945236",
    "1585841080431321088"
  ],
  "maxCommentsPerPost": 200
}
````

### Output example

```json
{
  "source_tweet_id": "20",
  "source_tweet_url": "https://x.com/i/status/20",
  "comment_id": "1903105387932295260",
  "comment_url": "https://x.com/kwanelencube07/status/1903105387932295260",
  "text": "@jack Hey @grok is this real was this in 2006?",
  "display_text": "Hey @grok is this real was this in 2006?",
  "created_at": "2025-03-21T15:24:17+00:00",
  "lang": "en",
  "likes": 144,
  "retweets": 7,
  "replies": 18,
  "quotes": 2,
  "bookmarks": 16,
  "views": 421751,
  "author_name": "#lovesosa",
  "author_handle": "@kwanelencube07",
  "author_followers": 124,
  "author_blue_verified": false,
  "mentions": ["jack", "grok"],
  "media_urls": [],
  "author": { "rest_id": "1401868242352807936", "description": "Libra. That all I can say" },
  "entities": { "user_mentions": [ ... ] }
}
```

### Use cases

- **Sentiment analysis** - export every reply under a tweet and run sentiment or topic models.
- **Brand and reputation monitoring** - track how audiences react to brand and competitor posts.
- **Community and audience research** - find the most engaged and influential repliers.
- **Customer feedback** - collect feedback and questions from replies to product announcements.
- **Giveaway and contest auditing** - pull the full list of participants who replied.
- **Datasets and training data** - build labelled datasets of short-form conversation text.

### Frequently asked questions

**Do I need an X (Twitter) account, login, cookies or API key?**
No. Just paste tweet URLs or IDs.

**Can I scrape comments from several tweets at once?**
Yes. Add multiple URLs/IDs to `postUrls`; each is scraped and paginated independently.

**Can I get all the comments on a post?**
Set `maxCommentsPerPost` to `0` to fetch all available comments, or a number to cap each post.

**Does it work with both x.com and twitter.com links?**
Yes. Both `x.com/.../status/<id>` and `twitter.com/.../status/<id>` URLs work, as do bare numeric tweet IDs.

**What export formats are supported?**
JSON, CSV, Excel, XML and HTML, plus the Apify API and integrations (Google Sheets, Zapier, Make, webhooks).

**Is scraping X (Twitter) comments legal?**
This Actor collects publicly available data. You are responsible for how you use the data and for complying with applicable laws and X's terms.

### Pricing

This Actor is **pay per comment**: you are charged per comment returned, plus standard Apify platform usage. See the **Pricing** tab for the current rate.

### 🛠️ Our other scrapers

Explore our full suite of scraping tools:

- **[TikTok Scraper](https://apify.com/vulnv/tiktok-scraper)** - profiles, hashtags, music and trending posts.
- **[Douyin Scraper](https://apify.com/vulnv/douyin-search-scraper)** - search 抖音 videos, creators and downloads.
- **[Instagram Posts Scraper](https://apify.com/vulnv/instagram-posts-scraper)** - posts, captions and engagement.
- **[Yelp Business Scraper](https://apify.com/vulnv/yelp-scraper)** - business details and reviews.

📬 **Need help or have a feature request?** Contact us at <support@vulnv.com> or visit our [Apify profile](https://apify.com/vulnv).

# Actor input Schema

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

One or more X (Twitter) post URLs (e.g. https://x.com/user/status/1878...) or bare tweet IDs. Comments are scraped for each post independently.

## `maxCommentsPerPost` (type: `integer`):

How many comments to fetch for each post. Cost scales linearly. Set 0 to fetch all available comments.

## Actor input object example

```json
{
  "postUrls": [
    "https://x.com/elonmusk/status/1849867576720945236"
  ],
  "maxCommentsPerPost": 100
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped comments in the default dataset.

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

Overview table of comments, authors and engagement.

## `detail` (type: `string`):

Author details, mentions, media and the full nested objects.

# 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/1849867576720945236"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("vulnv/twitter-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/1849867576720945236"] }

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X (Twitter) Comments Scraper - Export Tweet Replies",
        "description": "Scrape comments and replies from any X (Twitter) post. Export the reply text, author profile, likes, retweets, reply and view counts to JSON, CSV or Excel. No login or cookies needed.",
        "version": "1.0",
        "x-build-id": "TWp88cpuxrNXihG4s"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/vulnv~twitter-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-vulnv-twitter-comments-scraper",
                "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/vulnv~twitter-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-vulnv-twitter-comments-scraper",
                "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/vulnv~twitter-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-vulnv-twitter-comments-scraper",
                "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": [
                    "postUrls"
                ],
                "properties": {
                    "postUrls": {
                        "title": "🐦 Tweet URLs or IDs",
                        "type": "array",
                        "description": "One or more X (Twitter) post URLs (e.g. https://x.com/user/status/1878...) or bare tweet IDs. Comments are scraped for each post independently.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxCommentsPerPost": {
                        "title": "💬 Maximum comments per post",
                        "minimum": 0,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "How many comments to fetch for each post. Cost scales linearly. Set 0 to fetch all available comments.",
                        "default": 100
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
