# X / Twitter Posts Scraper — Profile & Post URLs (`fetch_cat/tweet-scraper`) Actor

Export public X/Twitter posts from profile or post URLs, with text, authors, engagement counts, and media links. Download JSON or CSV. Search queries are not supported.

- **URL**: https://apify.com/fetch\_cat/tweet-scraper.md
- **Developed by:** [Hanna Nosova](https://apify.com/fetch_cat) (community)
- **Categories:** Social media, Marketing
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.09 / 1,000 item processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## X / Twitter Posts Scraper — Profile & Post URLs

Export public X (Twitter) posts from supplied profile or individual post URLs. Get post text, author details, visible engagement counts, media links, and source metadata for research or monitoring.

Public profile and post URLs only: X search queries and search-result URLs are not supported. No protected or login-only content is included.

### Ready-to-run examples

Open a saved example to inspect its inputs, then adjust the limits and filters for your own run. Examples are starting points; source availability can change.

- [Export public X profile posts](https://apify.com/fetch_cat/tweet-scraper/examples/export-public-x-profile-posts)

[View all ready-to-run examples](https://apify.com/fetch_cat/tweet-scraper/examples)

### Quick start

```json
{
  "startUrls": [
    {
      "url": "https://x.com/elonmusk"
    }
  ],
  "maxItems": 5
}
```

### Output dataset

Illustrative shortened post record; the example text, author, and counts are not live evidence.

```json
{
  "id": "2093127984701989032",
  "url": "https://x.com/example/status/2093127984701989032",
  "text": "Example public post text",
  "createdAt": "2026-08-28T00:06:14.000Z",
  "likeCount": 40194,
  "repostCount": 3852,
  "author": { "username": "example", "name": "Example Author" },
  "sourceType": "profile"
}
```

| Field | Description |
| --- | --- |
| `id`, `url`, `twitterUrl`, `text` | Stable post identity, canonical links, and public post text. |
| `createdAt`, `lang` | Publication timestamp and language when the public response provides them. |
| `replyCount`, `repostCount`, `likeCount`, `quoteCount`, `bookmarkCount`, `viewCount` | Visible engagement metrics; unavailable values are `null`. |
| `isReply`, `isRetweet`, `isQuote` | Post relationship flags where publicly detectable. |
| `mediaUrls` | Unique public media URLs attached to a post. |
| `author` | Public author ID, username, display name, profile URL/image, follow counts, and verification flags when available. |
| `sourceUrl`, `sourceType`, `paginationCursor`, `scrapedAt`, `partialSourceFailure` | Requested source, source mode, collection time, and partial-run indicator. `paginationCursor` records the public cursor used for a continued profile page, or is `null` for the first page/status URLs. |

### Input settings

| Setting | JSON key | Type / default | What it does |
| --- | --- | --- | --- |
| Start URLs | `startUrls` | array / not set | Public X / Twitter tweet profile or status URLs for social listening, tweet monitoring, and content research. Search URLs are not supported because X requires login for search. |
| Maximum items | `maxItems` | integer / `10` | Maximum public X / Twitter tweets to save from supported anonymous profile pages (1–100). The Actor follows bounded public timeline cursors while they advance. Minimum 1; maximum 100. |

### Pricing

The `start` event is charged once for a valid run. The `item` event applies to each exported post. Failed sources are not themselves paid post records; successfully saved posts remain billable in a partial run.

See the [live Pricing tab](https://apify.com/fetch_cat/tweet-scraper/pricing) for current rates and discounts. Check the cost shown for your account before scaling a run; any applicable platform usage is shown by Apify separately.

### Why use this X tweet scraper?

- Export public post text, canonical links, author details, visible engagement, and media URLs.
- Start from public profile URLs or direct `/status/<id>` links.
- Keep requested source URLs and collection timestamps alongside every saved record.
- Deduplicate posts across multiple supplied sources in one run.

### Use cases

A **Twitter tweet scraper** workflow can monitor posts from a public company, creator, or community account. An **X profile scraper** workflow can turn a supplied public account URL into a compact, reusable post dataset.

- Monitor posts from a public company, creator, or community account.
- Build a research dataset for content analysis or reporting.
- Preserve public post references for editorial review.
- Send normalized public post data to spreadsheets, databases, or automation workflows.

### Tips

- Supply one or more direct public profile or post URLs in `startUrls`.
- Use direct status URLs when you need a single public post.
- X search URLs and query strings are not supported in this version because a stable anonymous result route is not available.
- Review `partialSourceFailure` and the `RUN_SUMMARY` record when a multi-source run has mixed results.

### Who is it for?

This Actor is for social media teams, researchers, analysts, and automation builders who need a repeatable export of public X posts from known profiles or status links. It is not a search engine and does not collect protected or login-only posts.

### Start on Apify

1. Open **X Tweet Scraper** in the Apify Store and click **Try for free**.
2. Add one or more public profile or direct status URLs under **Start URLs**.
3. Set a low `maxItems` first, then run the Actor and export the default dataset as JSON or CSV.

### FAQ

#### Can I scrape X search results?

No. This version supports public profile and direct status URLs only. It rejects search URLs rather than returning a login page or unrelated records.

#### Can I use the Actor via API or MCP?

Yes. Submit the same input through the Apify API, retrieve the default dataset, or enable this Actor in an Apify MCP tool selection.

#### What happens if one source fails?

Completed posts are retained. Check `partialSourceFailure` and `RUN_SUMMARY` to identify a source that was private, deleted, rate-limited, or no longer publicly available.

#### Is this for public data only?

Yes. Do not use it to access protected content, bypass access controls, or collect data in violation of applicable laws or platform terms.

### Related Actors

- [X Profile Tweets Scraper](https://apify.com/fetch_cat/x-profile-tweets-scraper)
- [X User Profile Scraper](https://apify.com/fetch_cat/x-user-profile-scraper)
- [X Followers Scraper](https://apify.com/fetch_cat/x-followers-scraper)
- [Instagram AI Transcript Extractor](https://apify.com/fetch_cat/instagram-ai-transcript-extractor)
- [TikTok Sound Scraper](https://apify.com/fetch_cat/tiktok-sound-scraper)
- Browse more [FetchCat Actors](https://apify.com/fetch_cat) for adjacent public-data workflows.

### API usage

Use your Apify API token through the `APIFY_TOKEN` environment variable. Node.js and Python examples wait for the run and read its first dataset page; paginate the dataset for larger exports.

**Node.js**

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('fetch_cat/tweet-scraper').call({
  "startUrls": [
    {
      "url": "https://x.com/elonmusk"
    }
  ],
  "maxItems": 5
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python**

```python
import json
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run_input = json.loads('''{
  "startUrls": [
    {
      "url": "https://x.com/elonmusk"
    }
  ],
  "maxItems": 5
}''')
run = client.actor("fetch_cat/tweet-scraper").call(run_input=run_input)
print(client.dataset(run["defaultDatasetId"]).list_items().items)
```

**cURL**

Save the quickstart JSON as `input.json`. This request starts a run asynchronously; use its returned run ID to check completion and its `defaultDatasetId` to retrieve results.

```bash
curl -X POST "https://api.apify.com/v2/acts/fetch_cat~tweet-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @input.json
```

### MCP and AI agents

Use the official [Apify MCP server](https://docs.apify.com/integrations/mcp), not a separate custom server. The focused URL below selects this Actor. Authenticate with Apify when your client prompts you; configuration syntax and OAuth support depend on the client.

**Claude Code**

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=fetch_cat/tweet-scraper"
```

**HTTP-capable MCP client configuration**

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=fetch_cat/tweet-scraper"
    }
  }
}
```

**Example prompt:** "Export up to five posts from this public X profile URL. Show post text, dates, engagement, and source links; flag partial results."

Use the same input keys as the input table. Review the returned source URLs and any error or availability fields before using results in an automated summary.

### Support

If a run fails or output looks wrong, open an issue from the Actor page. Include the Apify run ID or run URL, non-sensitive input JSON, expected output, actual output, and one reproducible public URL (or the exact search input). Do not share tokens, cookies, passwords, or private data.

# Actor input Schema

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

Public X / Twitter tweet profile or status URLs for social listening, tweet monitoring, and content research. Search URLs are not supported because X requires login for search.

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

Maximum public X / Twitter tweets to save from supported anonymous profile pages (1–100). The Actor follows bounded public timeline cursors while they advance.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://x.com/elonmusk"
    }
  ],
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `run_summary` (type: `string`):

No description

## `pending_sources` (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 = {
    "startUrls": [
        {
            "url": "https://x.com/elonmusk"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/tweet-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 = { "startUrls": [{ "url": "https://x.com/elonmusk" }] }

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

```

## MCP server setup

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