# Twitter (X) Tweet Replies & Conversation Scraper (`smart_albatross/x-replies-scraper`) Actor

Collect public replies and nested conversation responses from tweet IDs or URLs. Combines native threads and conversation search with unique tweet IDs, full text, authors, engagement and media.

- **URL**: https://apify.com/smart_albatross/x-replies-scraper.md
- **Developed by:** [Dev](https://apify.com/smart_albatross) (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.20 / 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.

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

## Twitter (X) Tweet Replies & Conversation Scraper

Collect public replies and nested conversation responses from tweet IDs or URLs. Combines native threads and conversation search with unique tweet IDs, full text, authors, engagement and media.

### What this Actor collects

Collect replies using native thread pages plus Latest and Top conversation search. The original tweet is excluded. Supply a conversation-root tweet for nested replies; conversation membership is checked locally. directRepliesOnly restricts results to direct children of that root.

### Quick start

Enter inputs, start with a small maxItems, and run. No customer X cookies are required. Export the default dataset as JSON, CSV, Excel or JSONL, or use the Apify API.

```json
{
  "tweetIds": [
    "2107237881668313108"
  ],
  "maxItems": 100,
  "maxItemsPerSource": 100
}
```

### Limits and deduplication

maxItems is the total unique output ceiling, not a per-source allowance. maxItemsPerSource caps each input and defaults to maxItems. maxDurationSeconds defaults to 300 and cannot exceed 600. Account rate limits, spending limits and X visibility may yield fewer results. Startup has bounded retries; very short deadlines may elapse during initialization.

IDs are strings. No duplicate IDs are emitted within a run; migration recovery reconciles existing writes. If several inputs discover the same record, the **first source** gets attribution. This is a unique-profile/result export, not an exhaustive relationship-edge export.

### Output schema

Rows are normalized tweets with id, url, text/fullText, createdAt, author, engagement metrics, entities, media and conversation relationships. Every row includes sourceInput, sourceType and searchTerm. searchTerm is the query for user search, otherwise an empty string.

canDm reads dm_permissions.can_dm or legacy.can_dm: true/false when reported, null when unknown. Permission can depend on the authenticated X account; it is not a global guarantee that anyone may DM that profile.

The Output tab links to results and COVERAGE. COVERAGE lists source/strategy pages, limits, failures, repeated cursors and the exact stop reason. Dataset and output schemas are included for Store publishing.

### Coverage and responsible use

X may withhold protected, deleted, blocked, suspended or unindexed content, or shorten lists despite larger public counters. An empty result is **not a completeness guarantee**. This Actor does not bypass access controls. Follow applicable terms and privacy obligations.

### API

After deployment, POST JSON input to https://api.apify.com/v2/acts/<owner>~x-replies-scraper/runs using an Authorization bearer token. Read items from the run's default dataset. Never put tokens in public URLs.

### Operator setup

Not yet published; no price or Store publication is configured. Each new Actor requires secret X_ACCOUNTS and proxy environment configuration. Credentials never belong in input forms, source, datasets or logs. Arbitrary JavaScript mapping is not supported.

Prepare a clean build directory:

```sh
node scripts/prepare-actor.mjs replies
```

Build from .artifacts/actors/replies. Staging never deploys or publishes. Memory is fixed at 1024 MB. Pure HTTP with compressed responses and account-aware rate limits; no browser or third-party data API.

# Actor input Schema

## `tweetIds` (type: `array`):

Precision-safe digit strings or original tweet URLs. Use original tweets, not repost-wrapper IDs.

## `directRepliesOnly` (type: `boolean`):

False includes nested replies whose conversation root matches the input. True includes only direct replies to that root. The input tweet itself is excluded.

## `maxItems` (type: `integer`):

Run-wide ceiling shared across all inputs. Unique IDs only; spending limits or the runtime deadline may stop the run earlier.

## `maxItemsPerSource` (type: `integer`):

Optional per-handle, per-tweet or per-query cap shared by all strategies for that input. Defaults to maxItems. Duplicates attributed to earlier sources do not count again.

## `maxDurationSeconds` (type: `integer`):

Includes initialization and collection. Defaults to five minutes; very short deadlines may elapse during bounded startup. See COVERAGE for incomplete sources.

## Actor input object example

```json
{
  "tweetIds": [
    "2107237881668313108"
  ],
  "directRepliesOnly": false,
  "maxItems": 1000,
  "maxDurationSeconds": 300
}
```

# Actor output Schema

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

Stable normalized records with source attribution. Export through the dataset UI or API.

## `coverage` (type: `string`):

Stop reason, per-strategy page counts and failures. Output is not a completeness guarantee.

# 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 = {
    "tweetIds": [
        "2107237881668313108"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("smart_albatross/x-replies-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 = { "tweetIds": ["2107237881668313108"] }

# Run the Actor and wait for it to finish
run = client.actor("smart_albatross/x-replies-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 '{
  "tweetIds": [
    "2107237881668313108"
  ]
}' |
apify call smart_albatross/x-replies-scraper --silent --output-dataset

```

## MCP server setup

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