# Tweet Scraper for X (Twitter) — complete, no duplicates (`clearcaption/x-tweet-scraper-complete`) Actor

Scrape tweets by search, account or replies. Goes past X's pagination stop, dates that work, no duplicates, empty search = $0. $0.20 per 1,000 tweets.

- **URL**: https://apify.com/clearcaption/x-tweet-scraper-complete.md
- **Developed by:** [Paul Gallicin](https://apify.com/clearcaption) (community)
- **Categories:** Social media, Lead generation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 tweets

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/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 (Twitter) Tweet Scraper — complete, no duplicates, dates that work

Scrape tweets by **search**, **account** or **conversation (comments)**. Built from what users of the most popular X scrapers asked for and complained about.

### What you get

- **Past X's pagination stop.** X stops one search after a few hundred to ~2,000 tweets. This actor continues automatically (Latest sort) — no manual splitting into date ranges, no paying twice for overlaps.
- **Dates that always work.** `since` / `until` apply to searches, accounts and conversations. Tweets outside your window are **not saved and not charged**.
- **Pay only for unique tweets.** Duplicates are removed **before** charging. No placeholder / "noResults" / demo rows — an empty search costs $0.
- **Exact counts.** `maxItems: 100` gives 100 tweets if they exist. `maxItemsPerTarget: 10` gives 10 from **each** account / search.
- **Accounts:** uses the account timeline (more complete than `from:` search, includes replies) and continues by search when X stops the timeline.
- **Comments:** direct replies **and** nested reply threads, merged without duplicates.
- **Any X link** in `startUrls`: tweet → its comments, profile → its tweets, search URL → that search.
- **A bad target does not stop the run:** a deleted account or tweet is skipped with a reason; the rest is collected.
- **Honest errors:** if the data source fails, the run fails with the reason (not "Succeeded" with 0 rows). Partial results are kept and only they are charged.
- **Same input as other popular X actors:** field names of `apidojo/tweet-scraper` (`start`, `end`, `sort`, `tweetLanguage`, `minimumFavorites`, `onlyImage`, `author`…) and the operator fields (`from`, `to`, `@`, `filter:images`, `min_faves`, `since_time`…) are accepted as-is — paste your existing JSON.

### Compared with typical X scrapers

| | This Actor | Typical X tweet actors (from their users' issues) |
|---|---|---|
| Search stops after a few hundred / ~2,000 tweets | continues automatically | you split date ranges by hand |
| `since` / `until` | work for search, accounts and replies | sometimes ignored, out-of-range tweets charged |
| Empty search / "noResults" rows | **$0**, no placeholder rows | demo or placeholder rows charged |
| Duplicates | removed **before** charging | charged, removed by you |
| Data source failure | run fails with the reason, partial data kept | "Succeeded" with 0 rows |
| Input JSON of `apidojo/tweet-scraper` | accepted as-is | — |

### Use it from AI agents (MCP): Claude, ChatGPT, Cursor, n8n

```json
{
  "mcpServers": {
    "x-tweets": {
      "url": "https://mcp.apify.com?tools=clearcaption/x-tweet-scraper-complete",
      "headers": { "Authorization": "Bearer <YOUR_APIFY_TOKEN>" }
    }
  }
}
```

Then ask: *"Get the latest 300 English tweets about 'openai' since yesterday with at least 50 likes."*

**Ask an AI about this Actor:**
[ChatGPT](https://chatgpt.com/?q=How%20do%20I%20use%20the%20ClearCaption%20Tweet%20Scraper%20for%20X%20on%20Apify%20\(https%3A%2F%2Fapify.com%2Fclearcaption%2Fx-tweet-scraper-complete\)%3F) ·
[Claude](https://claude.ai/new?q=How%20do%20I%20use%20the%20ClearCaption%20Tweet%20Scraper%20for%20X%20on%20Apify%20\(https%3A%2F%2Fapify.com%2Fclearcaption%2Fx-tweet-scraper-complete\)%3F) ·
[Perplexity](https://www.perplexity.ai/search?q=How%20do%20I%20use%20the%20ClearCaption%20Tweet%20Scraper%20for%20X%20on%20Apify%20\(https%3A%2F%2Fapify.com%2Fclearcaption%2Fx-tweet-scraper-complete\)%3F)

### Price

**$0.20 per 1,000 tweets** ($0.0002 per unique tweet saved). You pay only for unique tweets that pass your filters: duplicates, tweets outside your dates, skipped targets and empty searches cost $0. Set *Max cost per run* to cap spending.

### Input example

```json
{ "searchTerms": ["bitcoin lang:en"], "since": "2026-11-01", "until": "2026-11-20", "maxItems": 5000, "min_faves": 5 }
```

### Output

Example row (values shortened):

```json
{
  "id": "2126255460659712101",
  "url": "https://x.com/example_user/status/2126255460659712101",
  "text": "Bitcoin just printed a death cross. 50-day under the 200-day…",
  "createdAt": "Fri Nov 27 10:03:00 +0000 2026",
  "lang": "en",
  "likeCount": 1, "retweetCount": 0, "replyCount": 0, "viewCount": 39,
  "author": { "userName": "example_user", "name": "Example", "followers": 15324 }
}
```

Every row is a real tweet: `id`, `url`, `text`, `createdAt`, `lang`, `author{…followers…}`, like/retweet/reply/quote/view/bookmark counts, `media` (video `.mp4` links), `entities`, full `retweeted_tweet` / `quoted_tweet`, reply fields, `conversationId`, plus `target` (and `searchTerm` if `includeSearchTerms`). Text is passed through unchanged.

### Where the data comes from

To be transparent: this actor reads public X data through a third-party X data API provider. Your search terms / handles are sent to that provider to fetch the tweets; nothing else about you or your account is sent. Results are stored only in your Apify dataset.

### Known limits

- `Top` sort is one X result chain (X does not order Top by time, so it cannot be continued reliably). Use `Latest` for volume.
- X search does not index every reply; for "all tweets of an account" use `twitterHandles` (timeline), not `from:` search.
- The run log shows `STATS`: provider calls, delivered, duplicates removed, rows filtered out (not charged), skipped targets with reasons.

# Actor input Schema

## `searchTerms` (type: `array`):

X search queries; advanced operators allowed (e.g. <code>bitcoin lang:en -filter:replies</code>). Each term is a separate search; the actor continues past X's pagination stop automatically (Latest).

## `twitterHandles` (type: `array`):

Accounts (with or without @). Uses the account timeline (more complete than from: search) and continues by search when X stops the timeline.

## `conversationIds` (type: `array`):

Tweet IDs whose replies you want: direct replies AND nested reply threads, without duplicates.

## `startUrls` (type: `array`):

Any X link: tweet (→ its comments), profile (→ its tweets), search URL (→ that search).

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

Exactly this many unique tweets if they exist. You pay only for unique tweets written to the dataset.

## `maxItemsPerTarget` (type: `integer`):

Limit per search term / account / conversation (e.g. 10 from EACH account).

## `queryType` (type: `string`):

Latest = complete, continues past X's limit. Top = one X result chain (X does not sort Top by time, so it cannot be continued reliably).

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

ISO date/time or unix seconds. ALWAYS applied, also for accounts and conversations; tweets outside the window are neither saved nor charged.

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

ISO date/time or unix seconds, exclusive. Always applied.

## `lang` (type: `string`):

ISO code, e.g. en, de, pl.

## `min_faves` (type: `integer`):

No description

## `min_retweets` (type: `integer`):

No description

## `min_replies` (type: `integer`):

No description

## `min_views` (type: `integer`):

Checked on every tweet (X search has no such operator).

## `min_text_length` (type: `integer`):

Characters.

## `includeSearchTerms` (type: `boolean`):

Adds searchTerm so you can split results of several searches.

## `from` (type: `string`):

No description

## `to` (type: `string`):

No description

## `@` (type: `string`):

No description

## `near` (type: `string`):

No description

## `within` (type: `string`):

e.g. 15km

## `geocode` (type: `string`):

lat,long,radius

## `filter:images` (type: `boolean`):

No description

## `filter:videos` (type: `boolean`):

No description

## `filter:media` (type: `boolean`):

No description

## `filter:links` (type: `boolean`):

No description

## `filter:quote` (type: `boolean`):

No description

## `filter:replies` (type: `boolean`):

No description

## `-filter:replies` (type: `boolean`):

No description

## `filter:verified` (type: `boolean`):

No description

## `filter:blue_verified` (type: `boolean`):

No description

## `include:nativeretweets` (type: `boolean`):

No description

## Actor input object example

```json
{
  "searchTerms": [
    "apify"
  ],
  "maxItems": 100,
  "queryType": "Latest",
  "includeSearchTerms": false,
  "filter:images": false,
  "filter:videos": false,
  "filter:media": false,
  "filter:links": false,
  "filter:quote": false,
  "filter:replies": false,
  "-filter:replies": false,
  "filter:verified": false,
  "filter:blue_verified": false,
  "include:nativeretweets": false
}
```

# Actor output Schema

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

One row per unique tweet: text, date, author, engagement counts, media, quoted / retweeted tweet.

## `stats` (type: `string`):

Provider calls, tweets delivered, duplicates removed, rows filtered out (not charged), skipped targets with reasons.

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

// Run the Actor and wait for it to finish
const run = await client.actor("clearcaption/x-tweet-scraper-complete").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 = { "searchTerms": ["apify"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,clearcaption/x-tweet-scraper-complete"
        }
    }
}
```

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/VTtk27p5bYttK7RGn/builds/1jEp1JK08bQfp5DQZ/openapi.json
