# X (Twitter) Tweet Scraper by URL - Likes, Replies & Media (`aolmo/x-tweet-scraper`) Actor

Tweets (X posts) by URL or ID without login or API keys: full text, date, likes, replies, author with verified badge, photos and mp4 video, links, hashtags, mentions and the quoted tweet. Track likes over time. $0.0003 per tweet.

- **URL**: https://apify.com/aolmo/x-tweet-scraper.md
- **Developed by:** [Antonio del Olmo Tena](https://apify.com/aolmo) (community)
- **Categories:** Social media, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 tweet scrapeds

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

Scrape tweets (X posts) by URL or ID without logging in, without an X account and without API keys. Paste tweet links and the Actor returns one row per tweet with the full text (real links instead of t.co), date, likes, replies, the author with their verified badge, photos, the mp4 video in the best quality, hashtags, mentions, links and the quoted tweet. Schedule it to track how likes and replies grow: perfect for campaign reporting, influencer audits, social listening archives and research datasets.

You pay $0.0003 per tweet.

### What you get

One Dataset row per tweet:

- `id`, `url`, `text`, `createdAt`, `lang`, `isEdited`, `possiblySensitive`.
- `likes`, `replies` (retweets and views are not available without login).
- `isReply`, `inReplyToUser`, `inReplyToId`.
- `authorName`, `authorUsername`, `authorId`, `authorVerified`, `authorVerifiedType`, `authorAvatar`.
- `hashtags`, `mentions`, `links` (expanded URLs).
- `media`: type (photo, video, GIF), image URL, best `videoUrl` (mp4), size and duration.
- `quotedTweet`: id, URL, text and author of the quoted tweet.
- `likesChange`, `repliesChange`: growth since the previous run (null on the first run).

Deleted tweets, protected accounts and suspended accounts return a row with an `error` field and are not charged.

### How to use it

1. Open the **Input** tab.
2. Paste tweet URLs or IDs, one per line: `https://x.com/user/status/123...`, `https://twitter.com/...` or `1585341984679469056`.
3. Click **Start** and export the rows as JSON, CSV or Excel.
4. Schedule it (for example hourly during a campaign) to track likes and replies over time.

### Input

```json
{
  "tweetUrls": ["https://x.com/elonmusk/status/1585341984679469056", "20"]
}
```

| Field | Description |
|-------|-------------|
| `tweetUrls` | Tweet URLs (x.com or twitter.com) or numeric IDs. Up to 1,000 per run. |

### Output example

```json
{
  "id": "1585341984679469056",
  "url": "https://x.com/elonmusk/status/1585341984679469056",
  "text": "Entering Twitter HQ – let that sink in!",
  "createdAt": "2022-10-26T18:45:58.000Z",
  "likes": 1220612,
  "replies": 58030,
  "authorName": "Elon Musk",
  "authorUsername": "elonmusk",
  "authorVerified": true,
  "media": [{ "type": "video", "url": "https://pbs.twimg.com/ext_tw_video_thumb/...jpg", "videoUrl": "https://video.twimg.com/...mp4", "width": 1920, "height": 1080, "durationMs": 9301 }],
  "quotedTweet": null,
  "likesChange": null
}
```

### Pricing

Pay per event, no subscription:

- **Tweet scraped**: $0.0003 per tweet. 1,000 tweets cost $0.30.
- **Stats changed**: $0.0002 per tweet whose likes or replies changed since the previous scheduled run.

Deleted or protected tweets are free.

### Use it as an API

```bash
curl -X POST "https://api.apify.com/v2/acts/aolmo~x-tweet-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tweetUrls": ["https://x.com/jack/status/20"]}'
```

### FAQ

**Do I need an X account or API keys?** No. The Actor reads the public data X serves for embedded tweets.

**Can it search tweets or list a user's timeline?** No, it works with tweet URLs or IDs. X does not serve searches or timelines without login.

**Why are retweets and views missing?** X does not include them in the public embed data.

**Where is the data stored between runs?** In a Key-Value Store of your account named `micro-saas-state-x-tweet-scraper`, one key per tweet.

# Actor input Schema

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

One per line: https://x.com/user/status/123..., https://twitter.com/... or just the numeric ID. Up to 1,000 per run.

## `product` (type: `string`):

Internal. Leave as is.

## Actor input object example

```json
{
  "tweetUrls": [
    "https://x.com/elonmusk/status/1585341984679469056",
    "https://x.com/jack/status/20"
  ],
  "product": "x-tweet-scraper"
}
```

# Actor output Schema

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

Dataset items: url, changed, events, data, timestamp and error (when the target failed).

# 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 = {
    "tweetUrls": [
        "https://x.com/elonmusk/status/1585341984679469056",
        "https://x.com/jack/status/20"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aolmo/x-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 = { "tweetUrls": [
        "https://x.com/elonmusk/status/1585341984679469056",
        "https://x.com/jack/status/20",
    ] }

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

```

## MCP server setup

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