# X (Twitter) Scraper & Research (`benzac/x-twitter-scraper`) Actor

Read X/Twitter posts, profiles, timelines and threads with no API key or login. Keyless alternative to X API. Fallback chain: FxTwitter, VXTwitter, oEmbed. Honest 404 errors. No cookies needed.

- **URL**: https://apify.com/benzac/x-twitter-scraper.md
- **Developed by:** [Ben Zac](https://apify.com/benzac) (community)
- **Categories:** Social media, Automation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 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?

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 & Research - keyless reading without API keys

### What does X/Twitter Scraper do?

**X/Twitter Scraper** reads public X/Twitter content - single tweets, profiles, timelines, and threads - with **no API key, no login, and no cookies**. It is a keyless alternative to the X API: give it a handle or tweet URL, get clean JSON back.

### What X/Twitter Scraper does NOT do (explicit scope)

- **Private accounts** - only public content is accessible
- **DMs / direct messages** - not supported, never will be
- **Reliable keyword search** - public mirror instances don't serve search; the Actor returns an honest 404 envelope instead of garbage
- **Authenticated endpoints** - no login, no cookies, no session tokens
- **Real-time streaming** - batch mode only, no WebSocket/SSE
- **Media download** - returns media URLs, does not download files
- **Write operations** - read-only, no posting/liking/retweeting
- **Guaranteed uptime** - depends on public FxTwitter/VXTwitter mirrors

### Why use X/Twitter Scraper?

- **Zero setup**: no X developer account, no $100+/mo API tier, no tokens.
- **Honest failures**: single-tweet lookups walk a fallback chain (FxTwitter → VXTwitter → oEmbed) and, when everything fails, return a 404 envelope with per-backend errors - you always know why. Other modes use FxTwitter directly.
- **Automation-ready**: structured dataset output, run summary in the key-value store, Apify platform advantages - scheduling, API access, integrations, monitoring.
- **Cost-optimized**: 128 MB memory, no proxy, no browser. ~$0.00005 per run.

### What data can X/Twitter Scraper extract?

| Field | Type | Description |
|---|---|---|
| `text` | text | Tweet text (null on oEmbed-only fallbacks) |
| `author` / `author_name` | text | Handle and display name |
| `likes`, `retweets`, `replies`, `quotes`, `views` | number | Engagement stats (null when backend can't see them) |
| `created_at` | text | Post timestamp, in the format X serves |
| `created_at_iso` | text | Same timestamp as ISO 8601 (`2026-11-16T19:23:13.000Z`) |
| `media_urls` | array | Photo/video URLs |
| `url` | link | Canonical tweet URL |
| `backend` | text | Which backend served the item |
| `code` / `error` / `backend_errors` | mixed | Present only on the honest-404 envelope |

Profile mode returns `screen_name`, `name`, `followers`, `following`, `tweets`, `description`.

### How to use X/Twitter Scraper

1. Open the Actor and pick a **mode**: `single`, `batch`, `profile`, `timeline`, `thread`, or `search`.
2. Fill **handle** (profile/timeline), **tweetId** (single/thread), **tweetIds** (batch, array of IDs/URLs), or **query** (search).
3. Set **limit** (1-1000, default 10) for timeline/thread/search. Values over 20 need `paginate: true`.
4. Optionally set **apiBase** to point at an alternative FxEmbed-compatible instance - when set it is used exclusively, with no silent fallback.
5. Run. Download the dataset as JSON, CSV, Excel, or HTML.

### Limits worth knowing

| Limit | Value | Why |
|---|---|---|
| Tweets per account | ~800 | The mirror stops paginating there, even when `limit` asks for 1000 |
| Tweets per page | 20 | The server caps `count` at 20, so `paginate` is what raises the total |
| Timeline without proxy | 0 | FxTwitter blocks cloud IPs, so timeline and profile need `useProxy: true` |
| Concurrent jobs | 5 on Free | A burst of more starts returns HTTP 402 |

`limit` is a request, not a promise. The run summary carries `truncated`, `pages`, and `reason` (`cursor-exhausted`, `maxRuntimeSecs`, `page-budget`, `page-failed`), so a short result says why it is short.

`maxRuntimeSecs` (default 240) stops new page requests and returns what was collected, instead of letting a slow run lose everything at the timeout.

### How much will it cost?

Measured on the Apify platform (128 MB, no proxy):

| Scenario | Duration | Compute units | Cost (at $0.20/CU) |
|---|---|---|---|
| Single tweet lookup | ~3s | 0.00043 CU | ~$0.00009 |
| Profile lookup | ~3s | 0.00043 CU | ~$0.00009 |
| Timeline (10 tweets) | ~5s | ~0.0007 CU | ~$0.00014 |
| Thread (10 tweets) | ~6s | ~0.0008 CU | ~$0.00016 |
| Honest 404 (dead tweet) | ~6s (3 backends) | ~0.0008 CU | ~$0.00016 |

On the Free tier ($5/mo), this is effectively free for moderate use. Scheduled watchers (one timeline poll per hour) cost ~$0.10/month.

### Fallback chain

`FxTwitter API` → `VXTwitter API` (singles only - everything else 404s there) → `oEmbed` (singles: author + text, no stats) → honest 404 envelope with per-backend errors. Explicit `apiBase` override is respected with no silent fallback.

### Input

See the input tab for full configuration options. Complex fields:

- `tweetId` accepts a bare numeric ID or a full `x.com`/`twitter.com` URL
- `apiBase` must be a base URL (trailing slash stripped automatically)
- `handle` accepts `@handle`, bare handle, or full profile URL

### Output

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. The dataset has an "Overview" view with all fields in a table.

```json
{
  "backend": "fxtwitter",
  "type": "tweet",
  "id": "2101821385731395719",
  "author": "levelsio",
  "likes": 478,
  "retweets": 14,
  "replies": 9,
  "views": 63264,
  "url": "https://x.com/levelsio/status/2101821385731395719",
  "text": "Belly fat is killing your testosterone…"
}
```

A lookup that fails everywhere returns an honest envelope:

```json
{
  "backend": "fxtwitter+vxtwitter+oembed",
  "type": "error",
  "code": 404,
  "id": "1",
  "error": "single 1 unavailable",
  "backend_errors": ["https://api.fxtwitter.com: http-404", "..."]
}
```

### Tips

- Keep `limit` small for scheduled runs to limit compute unit usage.
- Single mode is the most reliable (works on all platforms). Timeline mode may need `useProxy: true` on cloud platforms (FxTwitter blocks cloud IPs). Search is not supported by public instances.
- Use the `SUMMARY` key-value store record for run metadata (mode, count, backends, pages, truncated, reason, errors).

### FAQ

#### Is this against X's terms?

The Actor only reads what public mirror APIs serve - no login, no circumvention. Use it for ethical purposes.

#### Why does search return 404?

Public FxTwitter instances don't implement search. The 404 envelope (with backend errors) is the correct answer. Use timeline mode per handle instead.

#### How fast is it?

A single tweet lookup takes ~3 seconds on 128 MB. A timeline of 100 tweets takes 9 to 21 seconds with proxy. Measured live: 12 accounts at 100 tweets each ran in parallel and finished 1200 tweets with 1200 unique IDs in 87 seconds. No browser, pure HTTP.

#### What if the mirror is down?

The fallback chain tries FxTwitter → VXTwitter → oEmbed. If all fail, you get an honest 404 with per-backend errors.

#### Can I use this as an API?

Yes. Use the Apify API (`apify-client` for JS/Python) to run the Actor programmatically. See the API tab for code examples.

#### Can I schedule runs?

Yes. Use Apify's built-in scheduler. For timeline polling, enable `useProxy: true` (FxTwitter blocks cloud IPs). Keep `limit` small to minimize cost. Single-tweet and batch lookups work without proxy.

#### Can I integrate with Zapier/Make/webhooks?

Yes. Use Apify webhooks to trigger actions on run completion. Export datasets as JSON/CSV/Excel.

#### How do I get one result per row?

The dataset has an "Overview" view. For raw JSON, use the API endpoint `{{links.apiDefaultDatasetUrl}}/items`.

#### What if I find a bug?

Use the Issues tab on the Actor's page. Include the input, the error envelope, and the run ID.

### Legal and compliance

This Actor only reads what public mirror APIs serve - no login, no cookies, no circumvention. It does not access private accounts, DMs, or authenticated content.

> Our Actors are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.

### Your feedback

We're always working on improving the performance of our Actors. If you've got any technical feedback or found a bug, please create an issue on the Actor's Issues tab.

### Integrations

- **Apify API**: Run programmatically via `apify-client` (JS/Python)
- **Webhooks**: Trigger actions on run completion
- **Scheduling**: Built-in cron scheduler
- **MCP**: Use via Apify MCP server for AI agent access
- **Export**: JSON, CSV, Excel, HTML, XML

### Changelog

#### 0.1.0 (2026-11-16)

- Initial release
- Fallback chain: FxTwitter → VXTwitter (singles) → oEmbed (singles) → honest 404 envelope
- Six modes: single, batch, profile, timeline, thread, search
- Batch mode: fetch multiple tweets by ID/URL in one run
- Cost-optimized: 128 MB memory, no proxy, early termination
- useProxy option: route through Apify proxy for timeline/profile on cloud IPs
- Profile mode: gets user info from profile endpoint, falls back to timeline for author details

# Actor input Schema

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

What to read: a single tweet, a batch of tweet IDs, a profile, recent timeline tweets, a thread, or a keyword search. Search is not served by the public mirrors, so it returns an honest 404 envelope.

## `handle` (type: `string`):

X handle (with or without @, URL accepted) for profile and timeline modes.

## `tweetId` (type: `string`):

Bare numeric ID or full x.com URL for single and thread modes.

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

Array of tweet IDs or URLs for batch mode. Fetches several tweets in one run, several at a time. Duplicate IDs are fetched once.

## `query` (type: `string`):

Keyword query for search mode. Public instances may 404 - the run still returns an honest error envelope.

## `limit` (type: `integer`):

Max tweets to return for timeline, thread and search modes (1-1000). Values above 100 need paginate=true to fetch more than one page.

## `apiBase` (type: `string`):

Optional alternative FxEmbed-compatible base URL. When set it is used exclusively - no silent fallback.

## `useProxy` (type: `boolean`):

Route requests through Apify proxy. Required for timeline/profile modes on cloud platforms (FxTwitter blocks cloud IPs). Adds small cost per request. Default: false.

## `paginate` (type: `boolean`):

Follow pagination to get more tweets than the per-request limit. Use with limit to control total. Adds ~1s per page. Default: false.

## `maxRuntimeSecs` (type: `integer`):

Stop requesting new pages after this many seconds and return what was collected. Keeps a long run inside its timeout instead of losing everything. Range 10-3600. Default: 240.

## Actor input object example

```json
{
  "mode": "timeline",
  "handle": "levelsio",
  "limit": 10,
  "useProxy": false,
  "paginate": false,
  "maxRuntimeSecs": 240
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with scraped X/Twitter data (tweets, profiles, errors)

## `summary` (type: `string`):

Run summary with mode, count, backends, and errors

# 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 = {
    "mode": "timeline",
    "handle": "levelsio",
    "limit": 10,
    "maxRuntimeSecs": 240
};

// Run the Actor and wait for it to finish
const run = await client.actor("benzac/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 = {
    "mode": "timeline",
    "handle": "levelsio",
    "limit": 10,
    "maxRuntimeSecs": 240,
}

# Run the Actor and wait for it to finish
run = client.actor("benzac/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 '{
  "mode": "timeline",
  "handle": "levelsio",
  "limit": 10,
  "maxRuntimeSecs": 240
}' |
apify call benzac/x-twitter-scraper --silent --output-dataset

```

## MCP server setup

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