# X Twitter Scraper: Tweets, Replies, Followers (No Mock Data) (`himanshu-data/x-twitter-scraper`) Actor

Twitter scraper for X: tweets by search, profile, link or replies, plus followers and following. Exact limits, real date filters, no mock data, and you pay only for real, unique rows.

- **URL**: https://apify.com/himanshu-data/x-twitter-scraper.md
- **Developed by:** [Himanshu Agrawal](https://apify.com/himanshu-data) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 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/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 Twitter Scraper: Tweets, Replies, Followers. No Mock Data

This Twitter scraper gets tweets from X by search query, profile, tweet link or replies, plus the followers and following of any public account. Every tweet comes with full text, likes, retweets, replies, quotes, bookmarks, views, media with video links, quoted and retweeted tweets, and author details. You pay only for real, unique rows, and IDs are always text, so long tweet IDs never get rounded.

### What you can use it for

- **Scrape tweets by keyword or hashtag** for brand monitoring, sentiment analysis and market research. Advanced X search operators work (`from:`, `since:`, `min_faves:`, `lang:`, `-filter:replies`).
- **Scrape a Twitter profile** to collect an account's tweets, optionally with its own replies.
- **Scrape tweet replies** to read the conversation under a launch, an announcement or a viral post.
- **Scrape Twitter followers and following** of public accounts for audience research and influencer lists, one row per user.
- **Fetch single tweets** from links or IDs to fill in metrics for tweets you already know.
- **Build AI and NLP datasets** of clean tweet text with dates, language and engagement numbers.

### Fair billing

- Only real tweets and users are charged. No demo, mock or placeholder rows, ever. If the data source sends one, it is dropped and counted in the run summary.
- No start fee, no per-run fee, no per-query fee, no minimum charge.
- Same price on every Apify plan, free plan included.
- Free Apify plan: up to 100 results per run (10 tweets fetched by link), so you can try it. Paid plans have no limit.
- Date filters and limits are enforced by the Actor itself. Tweets outside your dates or filters are skipped and not charged.
- `Max rows per input item` is exact: you never get, or pay for, more than you asked.
- Duplicates are never charged. A tweet found by two searches is saved once.
- An empty run costs nothing for results.
- When you hit your spending limit, the run stops cleanly.

### How to use

1. Open the [X Twitter Scraper](https://apify.com/himanshu-data/x-twitter-scraper) page and click **Try for free** (you sign in to your Apify account).
2. Fill in at least one source: search terms, profiles, tweet links, replies of tweets, or followers/following handles.
3. Set **Max rows per input item**, and optionally dates and filters.
4. Click **Start**. Rows appear in the **Output** tab while the run works.
5. Export the dataset as JSON, CSV or Excel, or check the `SUMMARY` record in the key-value store.

**API:** start a run and get the rows in one call with `POST https://api.apify.com/v2/acts/himanshu-data~x-twitter-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>` and the input as JSON in the body.

### Input

| Field | What it does |
|---|---|
| Search terms | X search queries, one per line. Advanced operators work. |
| Search sort | `Latest` (default) or `Top`. |
| Profiles | Handles or links: `nasa`, `@nasa`, `https://x.com/nasa`. Gets their tweets. |
| Include the profile's own replies | Off by default. |
| Tweet links or IDs | Fetch these tweets directly. |
| Replies of tweets | Tweet links or IDs whose replies you want. |
| Followers of / Following of | Handles whose followers or followed accounts you want. |
| Max rows per input item | Per search term, profile, tweet's replies or handle. Default 100. |
| Max rows for the whole run | Optional hard cap across everything. |
| From date / To date | Inclusive, UTC. Also sent to the data source to save requests. |
| Min likes, retweets, replies, views | Skip tweets below these numbers. |
| Language | Two-letter code such as `en`. |
| Exclude retweets / Exclude replies | Skip those tweets. |
| Only tweets with media / Only verified authors | Keep only those tweets. |

```json
{
  "searchTerms": ["openai lang:en -filter:replies"],
  "profiles": ["nasa"],
  "maxItems": 200,
  "startDate": "2026-10-01",
  "minLikes": 10
}
```

### Output

One row per tweet or user. Field names never change between runs. Real output (October 2026, text shortened):

```json
{
  "type": "tweet",
  "id": "2113358139999265160",
  "url": "https://x.com/NASA/status/2113358139999265160",
  "text": "That's our jam 🎼 Astronomers used @ChandraXray to find out that this radio wave...",
  "createdAt": "2026-10-22T19:53:39.000Z",
  "lang": "en",
  "likes": 3070,
  "retweets": 506,
  "replies": 209,
  "quotes": 40,
  "bookmarks": 176,
  "views": 535595,
  "isReply": false,
  "isRetweet": false,
  "isQuote": false,
  "conversationId": "2113358139999265160",
  "author": {
    "id": "11348282", "username": "NASA", "name": "NASA", "followers": 92310412, "following": 115,
    "verified": false, "blueVerified": true,
    "profileImageUrl": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_normal.jpg",
    "createdAt": "2007-12-19T20:20:32.000Z"
  },
  "media": [{ "type": "photo", "url": "https://pbs.twimg.com/media/HVQoB1nXIAAiLcW.jpg", "videoUrl": null, "durationMs": null }],
  "quotedTweet": null,
  "retweetedTweet": null,
  "mentions": ["chandraxray"],
  "source": "profile",
  "input": "nasa"
}
```

User rows have `type: "user"`, `id`, `username`, `name`, `bio`, `location`, `website`, `followers`, `following`, `tweetsCount`, `likesCount`, `verified`, `blueVerified`, `createdAt`, `profileImageUrl`, `bannerUrl`, `url`, `source`, `input`, `scrapedAt`. Missing values are `null`. `views` is `null` when X shows no count, never a fake 0.

Each run also writes a `SUMMARY` record to the key-value store. For every input item it lists rows delivered, rows skipped by dates or filters, duplicates, placeholder rows dropped, and why it stopped (`limit reached`, `no more results`, `provider error`, `spending limit` or `free plan limit`).

### Pricing

$0.25 per 1,000 tweets from searches, profiles and replies; $2 per 1,000 tweets fetched by link; $0.25 per 1,000 followers or following

### Integrations

- **Apify API** to start runs and read datasets from any language.
- **Python and JavaScript clients** (`apify-client`) for scripts and backends.
- **Zapier, Make and n8n** to send new tweets to Google Sheets, Slack, a CRM or a database.
- **MCP for AI agents:** connect the Apify MCP server to Claude, ChatGPT or another MCP client and the agent can run this Actor as a tool.
- **Schedules and webhooks** in Apify Console for daily or hourly runs.

### FAQ

**Do I need an X account or an API key?**
No. You only need an Apify account. You never enter X credentials.

**How many tweets can I get?**
Up to 1,000,000 rows per input item on paid plans, and up to 100 results per run on the free Apify plan. Profile timelines on X only go back about 3,200 tweets, so for a long history search `from:handle` with a date range.

**Why did I get fewer tweets than I asked for?**
Open the `SUMMARY` record. It says for each input why it stopped: no more results, tweets skipped by your dates or filters, duplicates, the spending limit or the free plan limit. Narrow searches and strict filters return fewer rows.

**Do I pay for empty or fake results?**
No. Placeholder rows are dropped, duplicates and filtered tweets are not charged, and an empty run costs nothing for results.

**Can I schedule it?**
Yes. Create a schedule in Apify Console, for example a daily search with `From date` set, and connect an integration to get the new rows.

**Which export formats are there?**
JSON, CSV, Excel, XML, HTML and JSONL from the dataset, or the API.

**Can I scrape replies to a tweet?**
Yes, with **Replies of tweets**. Replies work best on the first tweet of a thread.

**Is it legal to scrape X (Twitter)?**
The Actor collects only public data. You are responsible for how you use it: follow X's terms and the laws where you live, and take care with personal data (for example under GDPR). This is not legal advice.

### Tips

- Use `From date` and `To date` instead of paging through old tweets: the dates are sent to the data source, so fewer requests are needed.
- Set `Max rows for the whole run` when you run many search terms and want a firm total.

# Actor input Schema

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

X search queries, one per line. Advanced operators work: from:nasa, since:2024-01-01, min_faves:100, lang:en, -filter:replies and more.

## `searchSort` (type: `string`):

Latest gives the newest tweets first. Top gives what X ranks as most relevant.

## `profiles` (type: `array`):

Get the tweets of these accounts. Handles or profile links: nasa, @nasa or https://x.com/nasa. One per line.

## `includeReplies` (type: `boolean`):

On: profile tweets also include replies the account posted.

## `tweetUrls` (type: `array`):

Fetch these tweets directly, e.g. https://x.com/nasa/status/1234567890123456789 or just the ID. One per line.

## `repliesOf` (type: `array`):

Collect the replies to these tweets. Tweet links or IDs, one per line.

## `followersOf` (type: `array`):

Collect the followers of these accounts (one row per user). Handles or profile links, one per line.

## `followingOf` (type: `array`):

Collect the accounts these accounts follow (one row per user). Handles or profile links, one per line.

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

Maximum rows for each search term, profile, tweet's replies or handle's followers. Enforced exactly: the last page is trimmed.

## `maxTotalItems` (type: `integer`):

Optional hard cap across all input items. Leave empty for no total cap.

## `startDate` (type: `string`):

Only tweets posted on or after this day (UTC). Tweets outside the range are skipped and not charged.

## `endDate` (type: `string`):

Only tweets posted on or before this day (UTC, the whole day is included).

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

Skip tweets with fewer likes.

## `minRetweets` (type: `integer`):

Skip tweets with fewer retweets.

## `minReplies` (type: `integer`):

Skip tweets with fewer replies.

## `minViews` (type: `integer`):

Skip tweets with fewer views. Tweets with an unknown view count are skipped when this is set.

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

Two-letter language code, e.g. en, es, ja. Only tweets in this language.

## `excludeRetweets` (type: `boolean`):

Skip retweets.

## `excludeReplies` (type: `boolean`):

Skip tweets that are replies.

## `onlyWithMedia` (type: `boolean`):

Only tweets with a photo, video or GIF.

## `onlyVerifiedAuthors` (type: `boolean`):

Only tweets by verified accounts (legacy or blue check).

## Actor input object example

```json
{
  "searchTerms": [
    "openai"
  ],
  "searchSort": "Latest",
  "includeReplies": false,
  "maxItems": 20,
  "excludeRetweets": false,
  "excludeReplies": false,
  "onlyWithMedia": false,
  "onlyVerifiedAuthors": false
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "searchTerms": [
        "openai"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("himanshu-data/x-twitter-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 = {
    "searchTerms": ["openai"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("himanshu-data/x-twitter-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 '{
  "searchTerms": [
    "openai"
  ],
  "maxItems": 20
}' |
apify call himanshu-data/x-twitter-scraper --silent --output-dataset

```

## MCP server setup

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