# X (Twitter) Tweet/Posts Scraper (`bareezh_codes/x-tweet-scraper-by-url`) Actor

Scrape any public X (Twitter) post or X Article by URL: text, likes, replies, author, photos, video MP4 links, quoted tweet, hashtags. Full X Article body as Markdown with images. No login, no cookies. Auto-switches to residential proxy if X rate-limits.

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

## Pricing

from $0.35 / 1,000 tweets

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?

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) Tweet/Posts Scraper

Paste links to public X (Twitter) posts and get clean JSON for each one: text, like and reply
counts, author, photos and video links, the quoted tweet, hashtags, mentions and links.
**X Articles** (long-form posts) come back in full: title, cover image and the whole body as
Markdown with headings, bold text and inline images.

- **No login, no cookies.** Your X account is never used, so it can never be locked or banned.
- **Auto-unblock.** Requests go out directly first. If X starts rate-limiting the run, the Actor
  switches itself to Apify Residential Proxy with a fresh IP per retry. Nothing to configure.
- **You only pay for tweets you get.** Deleted, private or age-restricted tweets are skipped and
  logged, never charged.

### Who uses it

- Social media and PR teams tracking how specific posts perform
- Researchers and journalists archiving tweets cited in articles
- Content and growth teams collecting viral examples ("swipe files") for hooks and formats
- Developers who need tweet data in a pipeline without the X API's paid tiers

### Input

```json
{
  "tweetUrls": [
    "https://x.com/naval/status/1002103360646823936",
    "https://twitter.com/elonmusk/status/1585341984679469056"
  ],
  "maxTweets": 100
}
```

`x.com`, `twitter.com`, `mobile.twitter.com`, `fxtwitter.com` / `vxtwitter.com` links and bare tweet IDs all work.

### Output

One item per tweet:

```json
{
  "id": "1585341984679469056",
  "url": "https://x.com/elonmusk/status/1585341984679469056",
  "text": "Entering Twitter HQ – let that sink in! https://t.co/D68z4K2wq7",
  "createdAt": "2022-10-26T18:45:58.000Z",
  "lang": "en",
  "likeCount": 1221749,
  "replyCount": 81253,
  "isEdited": false,
  "possiblySensitive": false,
  "authorId": "44196397",
  "authorName": "Elon Musk",
  "authorHandle": "elonmusk",
  "authorBlueVerified": true,
  "authorAvatarUrl": "https://pbs.twimg.com/profile_images/.../aR-Kjpp4_normal.jpg",
  "inReplyToTweetId": null,
  "inReplyToHandle": null,
  "quotedTweetId": null,
  "quotedTweetUrl": null,
  "quotedTweetText": null,
  "hashtags": [],
  "mentions": [],
  "links": [],
  "media": [
    {
      "type": "video",
      "url": "https://pbs.twimg.com/ext_tw_video_thumb/1585341912877146112/pu/img/DwJ7wlGIe9iryk6N.jpg",
      "videoUrl": "https://video.twimg.com/ext_tw_video/1585341912877146112/pu/vid/1280x720/....mp4?tag=14"
    }
  ],
  "inputUrl": "https://twitter.com/elonmusk/status/1585341984679469056",
  "scrapedAt": "2026-10-01T14:30:00.000000+00:00"
}
```

For an X Article, `isArticle` is `true` and `article` holds the long-form content:

```json
"isArticle": true,
"article": {
  "title": "NOBODY GOOGLES ANYMORE. THEY ASK CHATGPT.",
  "previewText": "right now, someone is typing \"what's the best [thing you sell]\" into chatgpt...",
  "coverImageUrl": "https://pbs.twimg.com/media/HTZwFm9XgAA505w.jpg",
  "text": "right now, someone is typing ...\n\n![](https://pbs.twimg.com/media/HTZtBCOWoAANgSa.jpg)\n\n## the shortlist is the new page one\n\n...",
  "media": [
    { "type": "photo", "url": "https://pbs.twimg.com/media/HTZtBCOWoAANgSa.jpg", "videoUrl": null },
    { "type": "video", "url": "https://pbs.twimg.com/amplify_video_thumb/.../Ozc8b78gSkBSK4aY.jpg",
      "videoUrl": "https://video.twimg.com/amplify_video/.../1280x720/....mp4?tag=29" }
  ],
  "links": [],
  "wordCount": 1412
}
```

`article.text` is Markdown: headings, **bold**, lists, quotes, and photos/videos in their place
in the article. `article.media` lists every embedded photo and video; `article.links` lists links
from the article text.

For ordinary posts `isArticle` is `false` and `article` is `null`. `videoUrl` is the highest-bitrate MP4. Missing values are `null`; every item has the same keys.

### Pricing

Pay per result: you are charged once for each tweet saved to the dataset. Failed, deleted and
private tweets are free. Set a maximum cost per run in the run options and the Actor stops there.

### FAQ

**Do I need an X account, API key or cookies?** No.

**Why no retweet or view counts?** The Actor reads X's public embed data (what shows on news
sites that embed a tweet). That data has likes and replies but not retweets or views. Getting
those needs a logged-in session, which this Actor deliberately avoids.

**Does it get the full text of X Articles?** Yes. The article body comes from the public
FxTwitter API (open-source FxEmbed). If that service is down, the item still has the article
title, preview and cover, and `article.text` is `null`.

**Can it scrape a whole profile or a search?** No. It fetches the posts you link to. Profile
timelines and search need login on X today.

**Is it legal?** It only reads posts that are public on X. You are responsible for how you use
the data, including privacy law (GDPR/CCPA) where personal data is involved.

### Limits

- Public posts only. Protected accounts, deleted posts and age-restricted posts return nothing.
- X can change its public embed data at any time; we monitor the Actor daily.

# Actor input Schema

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

Links to public X posts, e.g. https://x.com/naval/status/1002103360646823936. twitter.com, mobile.twitter.com, fxtwitter/vxtwitter links and bare tweet IDs work too. Duplicates are removed.

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

Stop after this many URLs. Leave empty to fetch all.

## Actor input object example

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

# Actor output Schema

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

One item per tweet

# 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/naval/status/1002103360646823936",
        "https://x.com/elonmusk/status/1585341984679469056"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bareezh_codes/x-tweet-scraper-by-url").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/naval/status/1002103360646823936",
        "https://x.com/elonmusk/status/1585341984679469056",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("bareezh_codes/x-tweet-scraper-by-url").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/naval/status/1002103360646823936",
    "https://x.com/elonmusk/status/1585341984679469056"
  ]
}' |
apify call bareezh_codes/x-tweet-scraper-by-url --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bareezh_codes/x-tweet-scraper-by-url"
        }
    }
}
```

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/TdhWDZeXCDKB3lYHO/builds/hwQxeJ821crZBhVcu/openapi.json
