# Twitter (X.com) Tweets & Profiles Scraper (`fastdata/twitter-scraper`) Actor

Fast Twitter/X scraper with date filtering, deduplication, and per-account limits. Extract tweets, profiles, threads, and search results. Reliable date range filtering that actually works. You only pay for real results — zero charge on empty runs. JSON, CSV, Excel export.

- **URL**: https://apify.com/fastdata/twitter-scraper.md
- **Developed by:** [FastData Labs](https://apify.com/fastdata) (community)
- **Categories:** Social media, News, Lead generation
- **Stats:** 228 total users, 37 monthly users, 95.1% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## ⚡ Twitter/X Scraper — Profiles & Tweets | 5x Faster | No Login

Extract tweets, full profile data, and single tweet details from any public Twitter/X account. **No login or API key required.**

Built for speed — runs in **under 5 seconds** on just **256 MB** memory. Pure HTTP, no browser overhead. **5x faster and 10x less memory** than typical Twitter scrapers.

### Features

- **User Profiles** — Followers, following, bio, location, verification status, profile/banner images
- **User Tweets** — Full tweet text, engagement metrics (likes, retweets, replies, quotes, views, bookmarks), media URLs
- **Single Tweet Lookup** — Fetch any tweet by URL with full details and conversation thread
- **Date Range Filtering** — Filter tweets by `sinceDate` and `untilDate`. Unlike other scrapers, our date filter actually works reliably
- **Built-in Deduplication** — Automatically removes duplicate tweets across multiple sources
- **Per-Account Limits** — Scrape 50 accounts with 10 tweets each in a single run
- **Language Filtering** — Only get tweets in a specific language (en, ja, zh, es, etc.)
- **Media Extraction** — Photos, videos, GIFs with full-resolution URLs

### Why This Scraper?

| Feature | This Scraper | Others |
|---------|:---:|:---:|
| Date filtering that works | Yes | Often broken |
| Built-in deduplication | Yes | No |
| Per-account tweet limits | Yes | No |
| Single tweet + thread lookup | Yes | Often unsupported |
| Strictly honors maxTweets | Yes | May return/charge more |
| Speed (profile + 5 tweets) | ~5s | 10-40s |
| Memory | 256 MB | 512-4096 MB |

### Input Configuration

```json
{
    "twitterHandles": ["elonmusk", "BillGates", "naval"],
    "mode": "tweets",
    "maxTweets": 100,
    "maxTweetsPerAccount": 20,
    "sinceDate": "2024-01-01",
    "includeReplies": false,
    "includeRetweets": true,
    "deduplicate": true
}
```

#### Input Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `twitterHandles` | Array | Twitter usernames or profile URLs |
| `tweetUrls` | Array | Direct tweet URLs for single tweet lookup |
| `mode` | String | `profiles`, `tweets`, or `replies` |
| `maxTweets` | Integer | Maximum total tweets (default: 100) |
| `maxTweetsPerAccount` | Integer | Limit per account when scraping multiple handles |
| `sinceDate` | String | Only tweets after this date (YYYY-MM-DD) |
| `untilDate` | String | Only tweets before this date (YYYY-MM-DD) |
| `language` | String | ISO language code filter (e.g., `en`, `ja`) |
| `deduplicate` | Boolean | Remove duplicate tweets (default: true) |
| `includeReplies` | Boolean | Include reply tweets (default: false) |
| `includeRetweets` | Boolean | Include retweets (default: true) |

### Output Examples

#### Tweet Output

```json
{
    "id": "1519480761749016577",
    "url": "https://x.com/elonmusk/status/1519480761749016577",
    "text": "Next I'm buying Coca-Cola to put the cocaine back in",
    "createdAt": "Thu Apr 28 00:56:58 +0000 2022",
    "retweetCount": 587844,
    "likeCount": 4252293,
    "replyCount": 168886,
    "quoteCount": 167447,
    "viewCount": 256000000,
    "bookmarkCount": 21513,
    "isRetweet": false,
    "isReply": false,
    "language": "en",
    "media": [],
    "author": {
        "id": "44196397",
        "username": "elonmusk",
        "displayName": "Elon Musk",
        "profileImageUrl": "https://pbs.twimg.com/profile_images/.../photo_400x400.jpg",
        "isVerified": true
    },
    "hashtags": [],
    "mentions": [],
    "scrapedAt": "2026-03-13T14:11:45.260Z"
}
```

#### Profile Output

```json
{
    "id": "44196397",
    "username": "elonmusk",
    "displayName": "Elon Musk",
    "description": "Mars & Cars, Chips & Dips",
    "location": "Earth",
    "url": "https://t.co/...",
    "profileImageUrl": "https://pbs.twimg.com/profile_images/.../photo_400x400.jpg",
    "bannerImageUrl": "https://pbs.twimg.com/profile_banners/44196397/...",
    "followersCount": 236450000,
    "followingCount": 1294,
    "tweetCount": 99031,
    "listedCount": 167806,
    "createdAt": "Tue Jun 02 20:12:29 +0000 2009",
    "isVerified": true,
    "scrapedAt": "2026-03-13T14:11:43.163Z"
}
```

### Usage Examples

#### Scrape profiles only

```json
{
    "twitterHandles": ["elonmusk", "BillGates"],
    "mode": "profiles"
}
```

#### Get recent tweets with date filter

```json
{
    "twitterHandles": ["OpenAI"],
    "mode": "tweets",
    "maxTweets": 50,
    "sinceDate": "2025-01-01",
    "includeReplies": false
}
```

#### Fetch a single tweet by URL

```json
{
    "tweetUrls": ["https://x.com/elonmusk/status/1519480761749016577"],
    "mode": "tweets"
}
```

#### Multi-account scraping with per-account limit

```json
{
    "twitterHandles": ["elonmusk", "BillGates", "naval", "OpenAI", "Apify"],
    "mode": "tweets",
    "maxTweetsPerAccount": 10,
    "deduplicate": true
}
```

### Performance

| Metric | Value |
|--------|-------|
| Profile fetch | ~400ms |
| 5 tweets | ~1s |
| Single tweet detail | ~350ms |
| Memory usage | 256 MB |
| Compute units (5 tweets) | ~0.0004 CU |

### Export Formats

Results are stored in the Apify dataset and can be downloaded as:

- **JSON** — Raw structured data
- **CSV** — Spreadsheet compatible
- **Excel** — Direct .xlsx download
- **XML** — Machine-readable format

### Limits

- No authentication needed — uses guest access, no login or API key required
- \~800 tweets per profile without replies, ~3200 with replies
- Rate limits are handled automatically with retry and token rotation

### Support

Having issues? Open an issue on the [Issues tab](https://console.apify.com/actors/r6UjNjFt6fhkH7qIL#/issues) and we'll respond within 24 hours.

# Actor input Schema

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

List of Twitter usernames (e.g., 'elonmusk') or full profile URLs to scrape

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

List of specific tweet URLs to extract data from (including full conversation threads)

## `mode` (type: `string`):

What to scrape: profiles only, tweets from users, or tweet replies/threads

## `maxTweets` (type: `integer`):

Maximum total number of tweets to extract. We strictly honor this limit — you will never be charged for more than you requested.

## `maxTweetsPerAccount` (type: `integer`):

When scraping multiple handles, limit tweets per account. E.g., 10 tweets each from 50 accounts. Leave empty to use Max Tweets for each.

## `sinceDate` (type: `string`):

Only include tweets after this date. Format: YYYY-MM-DD (e.g., '2024-01-01'). Tweets before this date are filtered out.

## `untilDate` (type: `string`):

Only include tweets before this date. Format: YYYY-MM-DD (e.g., '2024-12-31'). Tweets after this date are filtered out.

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

Only include tweets in this language. ISO 639-1 code (e.g., 'en', 'ja', 'zh', 'es'). Leave empty for all languages.

## `deduplicate` (type: `boolean`):

Automatically remove duplicate tweets from results. Recommended when scraping multiple sources.

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

Whether to include reply tweets in the results

## `includeRetweets` (type: `boolean`):

Whether to include retweets in the results

## `proxyConfiguration` (type: `object`):

Proxy settings. Residential proxies recommended for best reliability.

## Actor input object example

```json
{
  "twitterHandles": [
    "elonmusk"
  ],
  "tweetUrls": [],
  "mode": "tweets",
  "maxTweets": 100,
  "deduplicate": true,
  "includeReplies": false,
  "includeRetweets": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset containing scraped tweets and profile data with engagement metrics, media URLs, and author information

# 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 = {
    "twitterHandles": [
        "elonmusk"
    ],
    "tweetUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("fastdata/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 = {
    "twitterHandles": ["elonmusk"],
    "tweetUrls": [],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("fastdata/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 '{
  "twitterHandles": [
    "elonmusk"
  ],
  "tweetUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call fastdata/twitter-scraper --silent --output-dataset

```

## MCP server setup

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