# X (Twitter) Scraper – latest posts, likes, views – $0.3/1k (`henrycrawl/x-latest-tweets`) Actor

Get the latest public posts of any X (Twitter) profile, or single posts by URL: text, date, likes, reposts, replies, quotes, bookmarks, views, hashtags, links. No login, no API key. Works with AI agents via Apify MCP. Pay per post; error rows are free.

- **URL**: https://apify.com/henrycrawl/x-latest-tweets.md
- **Developed by:** [Henry Crawl](https://apify.com/henrycrawl) (community)
- **Categories:** Social media, Marketing, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.30 / 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) Latest Posts Scraper – likes, views, reposts

Get the latest public posts of X (Twitter) profiles, or single posts by URL, with their engagement counts. No login, no cookies, no X API key.

It reads the public page that X shows to logged-out visitors. X shows about **5 latest posts per profile** there, so this Actor is made for monitoring many brand / news / government accounts cheaply, not for full timeline history.

### Output fields

| Field | Description |
|---|---|
| `postId` | X post id |
| `url` | Post URL (`https://x.com/i/status/<id>`) |
| `text` | Full post text |
| `createdAt` | Post date (ISO 8601, UTC) |
| `likeCount`, `repostCount`, `replyCount`, `quoteCount`, `bookmarkCount` | Public counts |
| `viewCount` | Public view count |
| `hashtags` | Hashtags in the post |
| `links` | Expanded links in the post |
| `mediaCount` | Number of photos / videos |
| `lang` | Language detected by X |
| `authorIsOrganization` | `true` when X marks the author as a Business or Government account |
| `organizationHandle` | Handle, only for Business / Government accounts (empty for regular users) |
| `sourceType` | `profile` or `post` |

Privacy: the Actor does not output names, handles or avatars of regular users, and skips replies written by other people.

### Example output (real run)

```json
{
  "sourceType": "profile",
  "postId": "2123798314843787300",
  "url": "https://x.com/i/status/2123798314843787300",
  "text": "We 💛 V-G-R\n\nOn the evening before Voyager 1 reached its one light-day distance from Earth, people all over the globe came together to celebrate humanity’s farthest reach into the universe. Learn more about this historic milestone: https://t.co/PYspGV59lY https://t.co/hxEdd4K411",
  "createdAt": "2026-11-20T15:19:11+00:00",
  "likeCount": 4450,
  "repostCount": 841,
  "replyCount": 218,
  "quoteCount": 66,
  "bookmarkCount": 321,
  "viewCount": 725866,
  "hashtags": [],
  "links": ["https://go.nasa.gov/3VxPANX"],
  "mediaCount": 1,
  "lang": "en",
  "authorIsOrganization": true,
  "organizationHandle": "NASA",
  "type": "result",
  "status": "OK"
}
```

### Input example

```json
{
  "profiles": ["NASA", "SpaceX", "NatGeo"],
  "postUrls": ["https://x.com/NASA/status/2123435938848067841"],
  "maxResults": 100
}
```

Invalid handles, protected / empty profiles and deleted posts give a free error row (`type: "error"`) and the run continues.

### Pricing

**$0.30 per 1,000 posts** (pay per event `result`). Error rows are free. `maxResults` caps what you can be charged.

### Use with AI agents (MCP)

Add this Actor to Claude, Cursor or any MCP client:

`https://mcp.apify.com/?tools=henrycrawl/x-latest-tweets`

Example prompt: "Get the latest posts from @NASA and @ESA and tell me which got the most views."

# Actor input Schema

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

X profiles to read: handle (NASA or @NASA) or profile URL. X shows about 5 latest posts per profile to logged-out visitors.

## `postUrls` (type: `array`):

Single X posts to read: post URL (x.com/.../status/ID) or numeric post id.

## `maxResults` (type: `integer`):

Maximum number of billed rows for the whole run (you are only charged for delivered rows).

## Actor input object example

```json
{
  "profiles": [
    "NASA",
    "SpaceX",
    "NatGeo"
  ],
  "postUrls": [],
  "maxResults": 15
}
```

# Actor output Schema

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

One row per result, plus free error rows (type = error).

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

Counts for this run (SUMMARY record).

# 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 = {
    "profiles": [
        "NASA",
        "SpaceX",
        "NatGeo"
    ],
    "postUrls": [],
    "maxResults": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("henrycrawl/x-latest-tweets").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 = {
    "profiles": [
        "NASA",
        "SpaceX",
        "NatGeo",
    ],
    "postUrls": [],
    "maxResults": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("henrycrawl/x-latest-tweets").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 '{
  "profiles": [
    "NASA",
    "SpaceX",
    "NatGeo"
  ],
  "postUrls": [],
  "maxResults": 15
}' |
apify call henrycrawl/x-latest-tweets --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,henrycrawl/x-latest-tweets"
        }
    }
}
```

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/fKDZwuwwayhLjDqRC/builds/Ju5njxLekffPr9JQo/openapi.json
