# Twitter Scraper – Tweet Scraper / X Scraper / X.com Scraper (`codescraper/x-tweet-scraper`) Actor

Ultra-fast Twitter Scraper & X.com Tweet Extractor. Scrape tweets, user profiles, replies, media, and search with advanced filters. Extract views, bookmarks, likes, hashtags, and author analytics. Official Pay-Per-Event pricing ($0.30/1,000 tweets) with free guest mode and zero compute costs.

- **URL**: https://apify.com/codescraper/x-tweet-scraper.md
- **Developed by:** [CodeScraper](https://apify.com/codescraper) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.27 / 1,000 post scrapeds

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

## 🐦 Tweeter Scraper — Fast Tweet & X Data Extractor (Search, Profiles, Threads & Media)

Extract real-time tweets, author analytics, engagement metrics, media attachments, and complete conversation threads from **X (formerly Twitter)** at scale. Designed for speed, reliability, and cost-efficiency, **Tweeter Scraper** extracts data via direct API ingestion and server-side rendering (SSR), bypassing brittle browser automation while preserving data integrity.

Whether you need tweets for **AI model training, brand monitoring, financial sentiment analysis, influencer discovery, or competitor benchmarking**, Tweeter Scraper delivers fully structured, deduplicated JSON, CSV, and Excel datasets with zero compute surcharges.

***

### 💰 Transparent Pay-Per-Event Pricing

This Actor uses Apify's **Pay-Per-Event** monetization model with **Platform Usage (Compute & Proxies) 100% INCLUDED**. You never pay for expensive hourly server compute or bandwidth — you only pay for the exact volume of work performed.

#### Official Pricing Table

| Event / Resource | Free Tier (No discount) | Starter (Bronze) | Scale (Silver) | Business (Gold) | Description |
|---|---|---|---|---|---|
| **Post Scraped** | **$0.30** / 1,000 ($0.00030) | **$0.29** / 1,000 ($0.00029) | **$0.28** / 1,000 ($0.00028) | **$0.27** / 1,000 ($0.00027) | Charged only when a complete X/Twitter post with full metrics & author analytics is scraped. |
| **Result (Dataset Record)** | **$0.20** / 1,000 ($0.00020) | **$0.20** / 1,000 ($0.00020) | **$0.20** / 1,000 ($0.00020) | **$0.20** / 1,000 ($0.00020) | Charged per post record delivered and stored in your Apify dataset. |
| **Actor Start** | **$0.0005** / run | **$0.0005** / run | **$0.0005** / run | **$0.0005** / run | Flat micro-charge to initialize the Actor container per crawl run. |
| **Platform Usage (Compute & Proxies)** | **FREE ($0.00)** | **FREE ($0.00)** | **FREE ($0.00)** | **FREE ($0.00)** | Cloud compute, memory, and automated rotating proxy infrastructure are included at no extra cost. |

***

#### 🧮 Real-World Cost Examples

*You only pay for verified posts collected and saved to your dataset. Failed queries or empty searches cost $0.00.*

##### 🔹 500 Posts Run (e.g. Quick Brand or Handle Check)

- **Actor Start:** $0.0005
- **Results (Dataset Records):** 500 posts × $0.0002 = **$0.100**
- **Posts Scraped:** 500 posts × $0.0003 = **$0.150**
- **Compute & Proxies:** **FREE ($0.00)**
- 💵 **Total Cost:** **$0.25** *(Starter: $0.245 | Scale: $0.240 | Business: $0.235)*

##### 🔹 1,000 Posts Run (e.g. Weekly Hashtag or Influencer Audit)

- **Actor Start:** $0.0005
- **Results (Dataset Records):** 1,000 posts × $0.0002 = **$0.200**
- **Posts Scraped:** 1,000 posts × $0.0003 = **$0.300**
- **Compute & Proxies:** **FREE ($0.00)**
- 💵 **Total Cost:** **$0.50** *(Only 5¢ per 100 tweets! Starter: $0.49 | Scale: $0.48 | Business: $0.47)*

##### 🔹 5,000 Posts Run (e.g. Sentiment & Topic Deep Dive)

- **Actor Start:** $0.0005
- **Results (Dataset Records):** 5,000 posts × $0.0002 = **$1.000**
- **Posts Scraped:** 5,000 posts × $0.0003 = **$1.500**
- **Compute & Proxies:** **FREE ($0.00)**
- 💵 **Total Cost:** **$2.50** *(Starter: $2.45 | Scale: $2.40 | Business: $2.35)*

##### 🔹 10,000 Posts Run (e.g. Large-Scale AI / LLM Training Dataset)

- **Actor Start:** $0.0005
- **Results (Dataset Records):** 10,000 posts × $0.0002 = **$2.000**
- **Posts Scraped:** 10,000 posts × $0.0003 = **$3.000**
- **Compute & Proxies:** **FREE ($0.00)**
- 💵 **Total Cost:** **$5.00** *(Starter: $4.90 | Scale: $4.80 | Business: $4.70)*

##### 🔹 0 Posts Found (e.g. Inactive Account or Invalid Query)

- **Actor Start:** $0.0005
- **Results (Dataset Records):** 0 posts × $0.0002 = **$0.000**
- **Posts Scraped:** 0 posts × $0.0003 = **$0.000**
- 💵 **Total Cost:** **$0.0005** *(You never pay for posts that do not exist!)*

***

### ✨ Why Choose Tweeter Scraper?

| Capability | 🐦 Tweeter Scraper | Conventional Browser Scrapers | Official X API v2 |
|---|---|---|---|
| **Cost per 10K Posts** | **$5.00** flat | $15.00 – $40.00 (heavy compute) | $100.00+ (Basic tier) |
| **Compute & Bandwidth Fees** | **100% Free** (Included in PPE) | Expensive ($0.30–$0.60/hr) | Monthly subscription |
| **Extraction Speed** | **50 – 80 posts/second** | 2 – 5 posts/second | Rate limited |
| **Bookmark & View Counts** | ✅ **Full view & bookmark metrics** | ❌ Often missing | ⚠️ Partial |
| **Author Profile Analytics** | ✅ **Follower ratio, age, verification** | ⚠️ Minimal | ⚠️ Requires extra calls |
| **Web SSR Fallback** | ✅ **Extracts pre-rendered HTML if API gated**| ❌ Fails completely | ❌ None |
| **Multi-Account Cookie Pool**| ✅ **Automatic zero-downtime swapping** | ❌ Manual re-auth | ❌ Single app key |
| **Zero-Login Free Guest Mode**| ✅ **Works out of the box** | ❌ Usually requires login | ❌ Impossible |
| **Real-Time Data Streaming** | ✅ **Pushed per page batch** | ❌ All-or-nothing risk | ⚠️ Manual batching |

***

### 🎯 Target Data & Supported Sources

Extract data flexibly using any combination of targets:

- **🔎 Keyword & Hashtag Search:** Run any X search query (e.g. `artificial intelligence`, `#MachineLearning`, `crypto filter:verified`).
- **👤 User Profiles:** Scrape timelines for any creator, company, or politician (e.g. `elonmusk`, `NASA`, `OpenAI`).
- **💬 Conversation Threads & Replies:** Provide tweet URLs or conversation IDs to extract complete threaded discussions with replies.
- **📋 Twitter / X Lists:** Extract all recent tweets published across curated public lists.
- **🎚️ Dedicated Profile Tabs:** Dedicated toggles to isolate **Only Replies** (`/with_replies`), **Only Reposts**, or **Only Media**.
- **🧙 Smart Query Builder:** Combine date ranges (`since:` / `until:`), language filters (`lang:en`), minimum likes (`min_faves:`), and geocodes without typing raw query syntax.

***

### 🔓 Guest Mode vs. Cookie Mode

Tweeter Scraper works **100% free without any login or cookies** for most standard tasks. However, Twitter/X applies different server-side access tiers to unauthenticated visitors depending on the account type:

#### Twitter's 3-Tier Access Architecture

| Tier | Account Category | Examples | Free Guest Mode Capabilities |
|---|---|---|---|
| **Tier 1** | Established accounts created before ~2024 | `@NASA`, `@BBC`, `@Google` | ✅ **Full deep pagination** — hundreds to thousands of posts with zero credentials. |
| **Tier 2** | Mega-celebrity & high-traffic accounts | `@elonmusk` | ⚠️ **~99 highlight posts** — Twitter's server caps guest pagination for extreme-traffic profiles. |
| **Tier 3** | Newer or smaller accounts (created after ~2024, unverified) | Newer creators, personal blogs | ⚠️ **3–5 preview posts** — Twitter's API returns zero timeline entries to guests; our scraper automatically activates **Web SSR extraction** to recover all pre-rendered preview posts. |

> \[!NOTE]
> **Why do newer profiles return 3–5 posts in Guest Mode?**
> Twitter's backend servers gate newer account timelines behind authentication. For Tier 3 accounts, the GraphQL `UserTweets` endpoint returns `TimelineTerminateTimeline` with 0 records for logged-out visitors. Adding your cookies instantly turns on **Cookie Mode** and unlocks complete pagination across 100% of accounts!

#### Guest Mode vs. Cookie Mode Comparison

| Feature | Free Guest Mode | Cookie Mode (Unlocked) |
|---|---|---|
| **Established Profiles (Tier 1)** | ✅ Full Pagination | ✅ Full Pagination |
| **Individual Tweet URLs** | ✅ Full Data & Metrics | ✅ Full Data & Metrics |
| **Conversation Reply Threads** | ✅ Full Thread Ingestion | ✅ Full Thread Ingestion |
| **Public Twitter Lists** | ✅ Full Pagination | ✅ Full Pagination |
| **Newer Profiles (Tier 3)** | ⚠️ 3–5 Preview Posts (SSR) | ✅ **Full Deep Pagination** |
| **Global Keyword & Hashtag Search**| ❌ Gated by X | ✅ **Complete Search Engine** |
| **Dedicated User Replies Tab** | ❌ Gated by X | ✅ **Complete `/with_replies` feed** |
| **Dedicated User Media Tab** | ❌ Gated by X | ✅ **Complete `/media` feed** |

***

### 🍪 How to Get Your Twitter / X Cookies (Step-by-Step Guide)

You only need two values: **`auth_token`** and **`ct0`**. Both methods take less than 60 seconds:

#### Method 1: Built-in Chrome DevTools (Application Tab — No Extensions Needed)

Works out of the box in **Google Chrome**, **Microsoft Edge**, and **Brave Browser**:

1. **Log In:** Open [x.com](https://x.com) in your browser and log into your account.
2. **Open Inspect:** Right-click anywhere on the page and select **Inspect** (or press `Ctrl+Shift+I` on Windows/Linux or `Cmd+Option+I` on Mac).
   *(Note: On many laptops, pressing `F12` controls screen brightness or volume. Right-clicking → Inspect always works!)*
3. **Open Application Tab:** In the top DevTools tab bar, click **`>>`** (overflow menu) to reveal hidden tabs, then click **Application**.
4. **Navigate to Cookies:** In the left sidebar: Expand **Storage** → **Cookies** → click **`https://x.com`**.
5. **Copy Tokens:** In the table, find:
   - **`auth_token`**: Double-click its `Value` to copy (40-character hex string).
   - **`ct0`**: Double-click its `Value` to copy (CSRF token string).

![Method 1: Extract Cookies via Application Tab](https://iili.io/nkz7NkB.png)

***

#### Method 2: Using the Free Cookie-Editor Chrome Extension (Fastest — 1 Click)

If you prefer a 1-click visual interface or want to export cookies as a clean JSON array:

1. **Install Extension:** Add the free [Cookie-Editor Extension from Chrome Web Store](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm?hl=en).
2. **Open on X.com:** Navigate to [x.com](https://x.com) while logged in.
3. **Open Cookie-Editor:**
   - Click the Cookie-Editor icon in your browser's extensions toolbar, **OR**
   - Right-click anywhere → **Inspect** → click **`>>`** in the DevTools bar → select **Cookie-Editor**.
4. **Copy Tokens or Export JSON:**
   - **Option A (Individual Tokens):** Click on `auth_token` to expand and copy the `Value`. Do the same for `ct0`.
   - **Option B (1-Click JSON Export):** Click the **Export** button at the bottom of Cookie-Editor → choose **Export as JSON** → paste the entire JSON array directly into the **Twitter / X Cookies (JSON or String)** field in the actor!

![Method 2: Extract Cookies via Cookie-Editor Extension](https://iili.io/nkz2vWX.png)

***

### ⚙️ Input Configuration

Configure your extraction run using the input parameters below. All parameters are optional, but you must provide at least one source (URL, username, query, or thread ID).

#### Input Parameters Table

| Field | Type | Description | Default |
|---|---|---|---|
| `sourceUrls` | Array | List of X/Twitter URLs to extract data from (Post, Profile, Search, or List URLs). | `[]` |
| `userHandles` | Array | Specific X/Twitter handles to scrape posts from (without the `@` symbol, e.g. `elonmusk`). | `[]` |
| `queryTexts` | Array | Search queries supporting Twitter advanced search syntax (e.g. `from:NASA since:2024-01-01`). | `[]` |
| `threadIds` | Array | Tweet conversation IDs to scrape full reply threads from. | `[]` |
| `twitterCookies` | String | Paste exported cookies (JSON array from Cookie-Editor, or `auth_token=...; ct0=...`). | `""` |
| `authToken` | String | Individual `auth_token` cookie value (overrides `twitterCookies` if provided). | `""` |
| `ct0` | String | Individual `ct0` CSRF token value (used in combination with `authToken`). | `""` |
| `resultLimit` | Integer | Maximum number of posts to extract. Leave empty or enter `0` for unlimited. | `1000` |
| `sortOrder` | String | Sort order: `"Recent"` (newest first), `"Popular"` (top engagement), `"Recent + Popular"`, `"Media"`. | `"Recent"` |
| `onlyReplies` | Boolean | When enabled, extracts only reply posts (comments made to other tweets). | `false` |
| `onlyReposts` | Boolean | When enabled, extracts only reposted / retweeted content. | `false` |
| `onlyMedia` | Boolean | When enabled, extracts only tweets that contain attached photos, videos, or GIFs. | `false` |
| `contentLanguage` | String | Filter posts by ISO 639-1 language code (e.g. `"en"`, `"es"`, `"ja"`, `"fr"`, `"de"`). | `""` |
| `verifiedAccountsOnly`| Boolean | When enabled, restricts extraction strictly to verified accounts. | `false` |
| `premiumSubscribersOnly`| Boolean| When enabled, restricts extraction strictly to X Premium (Twitter Blue) subscribers. | `false` |
| `containsImages` | Boolean | Restrict to posts that include at least one photo. | `false` |
| `containsVideos` | Boolean | Restrict to posts that include at least one video attachment. | `false` |
| `containsLinks` | Boolean | Restrict to posts that contain outbound external URLs. | `false` |
| `containsPolls` | Boolean | Restrict to posts that include interactive voting polls. | `false` |
| `quotedPostsOnly` | Boolean | Restrict to quote tweets. | `false` |
| `excludeReposts` | Boolean | Filter out reposted / retweeted posts from results. | `false` |
| `excludeReplies` | Boolean | Filter out reply tweets from results. | `false` |
| `postedBy` | String | Query Builder: Filter posts created by this author handle (without `@`). | `""` |
| `replyingTo` | String | Query Builder: Filter posts created in reply to this user handle (without `@`). | `""` |
| `mentionsUser` | String | Query Builder: Filter posts that tag or mention this user handle (without `@`). | `""` |
| `minLikes` | Integer | Minimum number of likes (favorites) required per post. | `0` |
| `minReposts` | Integer | Minimum number of reposts (retweets) required per post. | `0` |
| `minReplies` | Integer | Minimum number of replies required per post. | `0` |
| `minBookmarks` | Integer | Minimum number of bookmarks required per post. | `0` |
| `minViews` | Integer | Minimum number of views (impressions) required per post. | `0` |
| `minAuthorFollowers` | Integer | Minimum author follower count required. | `0` |
| `fromDate` | String | Filter posts published on or after this date (`YYYY-MM-DD`). | `""` |
| `toDate` | String | Filter posts published on or before this date (`YYYY-MM-DD`). | `""` |
| `nearLocation` | String | Filter posts geotagged near a city or location (e.g. `"New York"`). | `""` |
| `locationRadius` | String | Search radius around the geotargeted location (e.g. `"15mi"` or `"25km"`). | `""` |
| `geoCoordinates` | String | Geographic bounding coordinates in format `latitude,longitude,radius`. | `""` |
| `placeId` | String | Filter posts tagged with a specific official X Place ID. | `""` |
| `includeUserAnalytics`| Boolean| Include enriched author analytics (follower ratio, account age in days). | `true` |
| `extractHashtags` | Boolean | Extract all hashtags into a dedicated, cleaned array field. | `true` |
| `extractMentions` | Boolean | Extract all mentioned usernames into a dedicated array field. | `true` |
| `extractMediaUrls` | Boolean | Extract direct CDN media URLs (photos, videos, GIFs) into an array. | `true` |
| `extractReplies` | Boolean | When scraping specific posts, automatically fetch all reply threads. | `false` |
| `includeQueryInOutput`| Boolean| Adds the query or source target that located the post into each record. | `false` |
| `outputTransformFunction`| String | Custom JavaScript function to reshape or filter output objects before saving. | `""` |
| `proxyConfiguration` | Object | Proxy configuration. Defaults to automatic Apify Datacenter Proxy rotation. | `{"useApifyProxy": true}` |

***

#### Input JSON Examples

##### 1. Keyword & Hashtag Search with Quality Filters

```json
{
    "queryTexts": ["artificial intelligence", "#MachineLearning"],
    "contentLanguage": "en",
    "sortOrder": "Popular",
    "minLikes": 50,
    "minReposts": 10,
    "twitterCookies": "auth_token=824377ff3f6f9f1e581df86f2c537c56c80b3d77; ct0=d68abfb81df39f3617f0fad2f1ded925a3d097bc",
    "resultLimit": 500
}
```

##### 2. Clean Profile Scraping (No Cookies Needed for Established Accounts)

```json
{
    "userHandles": ["NASA", "OpenAI"],
    "excludeReplies": true,
    "excludeReposts": true,
    "resultLimit": 200
}
```

##### 3. Deep Profile Ingestion with Media & Replies

```json
{
    "sourceUrls": ["https://x.com/elonmusk"],
    "onlyMedia": true,
    "twitterCookies": "auth_token=824377ff3f6f9f1e581df86f2c537c56c80b3d77; ct0=d68abfb81df39f3617f0fad2f1ded925a3d097bc",
    "resultLimit": 1000
}
```

##### 4. Visual Query Builder with Date & Geo Targeting

```json
{
    "postedBy": "TechCrunch",
    "fromDate": "2026-01-01",
    "toDate": "2026-10-25",
    "nearLocation": "San Francisco",
    "locationRadius": "25mi",
    "minViews": 5000,
    "resultLimit": 300
}
```

***

### 📊 Sample Output

Every post extracted is structured into a clean, normalized schema. Below is a complete real-world output example demonstrating all enriched fields, author metrics, media attachments, quotes, polls, and cards:

```json
{
    "entityType": "post",
    "postId": "1849129548203892736",
    "postUrl": "https://x.com/OpenAI/status/1849129548203892736",
    "legacyPostUrl": "https://twitter.com/OpenAI/status/1849129548203892736",
    "authorHandle": "OpenAI",
    "authorDisplayName": "OpenAI",
    "fullText": "Today we are introducing Canvas — a new interface for working with ChatGPT on writing and coding projects that go beyond simple chat. Available to Plus and Team users starting today! 🚀 https://t.co/d8K1L9oXmp #AI #ChatGPT #TechNews",
    "truncatedText": "Today we are introducing Canvas — a new interface for working with ChatGPT on writing and coding projects that go beyond simple chat. Available to Plus and Team users starting today! 🚀 https://t.co/d8K1L9oXmp #AI #ChatGPT #TechNews",
    "repostsCount": 4820,
    "repliesCount": 1340,
    "likesCount": 38910,
    "quotesCount": 1290,
    "bookmarksCount": 9420,
    "viewsCount": 2450000,
    "publishedAt": "2026-10-24T18:15:30.000Z",
    "contentLanguage": "en",
    "sourcePlatform": "X for Web",
    "isRepost": false,
    "isReplyPost": false,
    "isQuotePost": true,
    "isThreadPost": true,
    "threadIndex": 1,
    "sensitiveContent": false,
    "hashtags": [
        "#AI",
        "#ChatGPT",
        "#TechNews"
    ],
    "mentionedUsers": [
        "@ChatGPTapp",
        "@sama"
    ],
    "externalLinks": [
        "https://openai.com/index/introducing-canvas/"
    ],
    "mediaAttachments": [
        {
            "mediaType": "image",
            "mediaUrl": "https://pbs.twimg.com/media/GZb_8wDXwAAqJkP.jpg",
            "thumbnailUrl": "https://pbs.twimg.com/media/GZb_8wDXwAAqJkP?format=jpg&name=small",
            "width": 1920,
            "height": 1080,
            "durationMs": 0,
            "altText": "Preview of ChatGPT Canvas interface featuring split-screen writing and Python code refactoring tools."
        }
    ],
    "poll": {
        "totalVotes": 14280,
        "votingStatus": "closed",
        "endsAt": "2026-10-25T18:15:30.000Z",
        "options": [
            {
                "label": "Code Refactoring",
                "voteCount": 8568,
                "votePercentage": 60.0
            },
            {
                "label": "Long-form Writing",
                "voteCount": 5712,
                "votePercentage": 40.0
            }
        ]
    },
    "card": {
        "cardType": "summary_large_image",
        "title": "Introducing Canvas for ChatGPT",
        "description": "Canvas creates a dedicated workspace next to your chat where you can edit, improve, and code collaboratively.",
        "linkUrl": "https://openai.com/index/introducing-canvas/",
        "thumbnailUrl": "https://pbs.twimg.com/card_img/1849129548203892736/canvas_preview.png",
        "domain": "openai.com"
    },
    "quotedPost": {
        "quotedPostId": "1849100000000000000",
        "quotedPostUrl": "https://x.com/sama/status/1849100000000000000",
        "quotedAuthorHandle": "sama",
        "quotedText": "A major upgrade to how humans and AI collaborate on complex intellectual work. Very proud of this launch."
    },
    "article": {
        "articleId": "1849129548203892736",
        "headline": "Introducing Canvas: A New Paradigm for Human-AI Pair Programming",
        "summary": "Deep dive into the architecture, context-window management, and real-time document sync powering Canvas.",
        "coverImageUrl": "https://pbs.twimg.com/media/GZb_8wDXwAAqJkP.jpg",
        "publishedAt": "2026-10-24T18:15:30.000Z",
        "lastModifiedAt": "2026-10-24T19:00:00.000Z",
        "contentBlocks": [
            {
                "blockText": "Traditional chat interfaces force users into back-and-forth prompts. Canvas introduces inline code execution and targeted revisions.",
                "blockType": "paragraph"
            }
        ],
        "embeddedMedia": [
            "https://pbs.twimg.com/media/GZb_8wDXwAAqJkP.jpg"
        ]
    },
    "author": {
        "entityType": "author",
        "handle": "OpenAI",
        "profileUrl": "https://x.com/OpenAI",
        "legacyProfileUrl": "https://twitter.com/OpenAI",
        "userId": "4398624937",
        "displayName": "OpenAI",
        "isVerifiedAccount": true,
        "isPremiumSubscriber": true,
        "verificationCategory": "Business",
        "avatarUrl": "https://pbs.twimg.com/profile_images/1634097683262808064/7-nOtuSy_400x400.jpg",
        "bannerUrl": "https://pbs.twimg.com/profile_banners/4398624937/1689288000",
        "bioText": "Creating safe AGI that benefits all of humanity. Building ChatGPT, GPT-4, Canvas, and Sora.",
        "websiteUrl": "https://openai.com",
        "location": "San Francisco, CA",
        "followerCount": 3820450,
        "followingCount": 118,
        "totalPostCount": 4920,
        "listedCount": 18240,
        "accountCreatedAt": "2015-12-11T19:30:12.000Z",
        "isProtected": false,
        "followerToFollowingRatio": 32376.69,
        "accountAgeDays": 3970
    },
    "engagementRate": 2.27,
    "extractedAt": "2026-10-25T12:00:00.000Z",
    "searchQuery": "from:OpenAI Canvas",
    "placeInfo": {
        "id": "5a110d312052166f",
        "fullName": "San Francisco, CA",
        "country": "United States",
        "countryCode": "US",
        "placeType": "city"
    }
}
```

***

### 📋 Output Fields Defined

| Output Field | JSON Type | Description |
|---|---|---|
| `entityType` | `string` | Always `"post"`. Distinguishes record types in unified data pipelines. |
| `postId` | `string` | Unique X/Twitter tweet snowflake ID string. |
| `postUrl` | `string` | Modern canonical link to the tweet (`https://x.com/{handle}/status/{id}`). |
| `legacyPostUrl` | `string` | Legacy domain URL (`https://twitter.com/{handle}/status/{id}`). |
| `authorHandle` | `string` | Username of the post author (without `@`). |
| `authorDisplayName`| `string` | Display name of the author as shown on their profile. |
| `fullText` | `string` | Complete, unclipped body text of the post including emojis, links, and tags. |
| `truncatedText` | `string` | Initial teaser text if the post exceeds traditional character limits. |
| `likesCount` | `number` | Total number of likes (favorites) received. |
| `repostsCount` | `number` | Total number of reposts (retweets) received. |
| `repliesCount` | `number` | Total number of direct replies. |
| `quotesCount` | `number` | Total number of quote tweets generated from this post. |
| `bookmarksCount` | `number` | Total times this post has been saved/bookmarked by users. |
| `viewsCount` | `number` | Total public view/impression count as tracked by X. |
| `publishedAt` | `string` | ISO 8601 UTC timestamp of when the tweet was published. |
| `contentLanguage` | `string` | BCP 47 / ISO 639-1 language tag detected by X (e.g. `"en"`, `"es"`). |
| `sourcePlatform` | `string` | Client used to publish the tweet (e.g. `"X for Web"`, `"X for iPhone"`). |
| `isRepost` | `boolean` | `true` if the post is a retweet of another author's content. |
| `isReplyPost` | `boolean` | `true` if this tweet was created in response to another tweet. |
| `isQuotePost` | `boolean` | `true` if this tweet quotes and embeds another post. |
| `isThreadPost` | `boolean` | `true` if this tweet is part of a multi-post author thread. |
| `threadIndex` | `number` | Sequential position within an author's thread (1, 2, 3...). |
| `sensitiveContent` | `boolean` | `true` if flagged by X's safety classification systems. |
| `hashtags` | `array` | Normalized array of all hashtags appearing in the post text. |
| `mentionedUsers` | `array` | Normalized array of all user handles mentioned (`@handle`). |
| `externalLinks` | `array` | Expanded destination URLs for all links embedded in the tweet. |
| `mediaAttachments`| `array` | Array of media objects with direct CDN links, dimensions, and types. |
| `poll` | `object` | Voting choices, vote counts, percentages, and status for interactive polls. |
| `card` | `object` | Rich link preview metadata (title, summary, domain, thumbnail URL). |
| `quotedPost` | `object` | Reference data for quoted tweets (author handle, tweet ID, text). |
| `article` | `object` | Long-form X Article content, headlines, and block typography. |
| `author` | `object` | Nested profile analytics (followers, following ratio, account age in days). |
| `engagementRate` | `number` | Calculated engagement percentage `((likes+reposts+replies+quotes+bookmarks)/views)*100`. |
| `extractedAt` | `string` | ISO 8601 UTC timestamp when the scraper processed this record. |
| `searchQuery` | `string` | Search query or source URL that located this record. |
| `placeInfo` | `object` | Official geolocation and city metadata if geotagged. |

***

### 💼 Real-World Use Cases

- 🤖 **AI & LLM Training Datasets:** Harvest millions of conversational, high-signal conversational exchanges and developer code snippets.
- 📈 **Financial & Market Sentiment:** Gauge retail and institutional sentiment shifts on equities, commodities, and crypto in real time.
- 🏢 **Brand Protection & Crisis Monitoring:** Track customer dissatisfaction, viral complaints, and brand mentions before issues escalate.
- 🌟 **Influencer Discovery & Creator Vetting:** Evaluate true audience reach using authentic view-to-follower ratios and bookmark engagement.
- 📰 **Journalism & Breaking News Discovery:** Monitor official government releases, eyewitness dispatches, and emergency bulletins.
- 🕵️ **Competitor Intelligence:** Track competitor product announcements, customer feedback, marketing positioning, and viral campaigns.

***

### 🛡️ Enterprise Rate-Limit & Anti-Ban Architecture

Tweeter Scraper includes a resilient 5-tier architecture built to withstand Twitter's rate-limiting and anti-scraping defenses:

1. **🔄 Automatic Apify Datacenter Proxy Rotation:** Every request and retry routes through Apify's rotating proxy pool, preventing IP-level burst restrictions.
2. **⏱️ Precise `x-rate-limit-reset` Synchronization:** The scraper monitors Twitter's response headers (`x-rate-limit-remaining` and `x-rate-limit-reset`). If an account quota is reached, it dynamically sleeps until the exact reset second instead of terminating with an error.
3. **👥 Multi-Account Cookie Pool (Zero Downtime):** Supply multiple accounts in `authToken` (separated by commas) or via `twitterCookies`. When Account #1 exhausts its window, the scraper instantly switches to Account #2 with zero downtime.
4. **🎲 Adaptive Jittered Pacing (AIMD):** Smart pacing ($1,200\text{ms} - 1,800\text{ms}$) with Gaussian jitter simulates organic browsing behavior and avoids anti-bot traps.
5. **💾 Real-Time Dataset Streaming:** Extracted posts are streamed directly into your Apify Dataset batch-by-batch. If you ever stop or abort a crawl early, every single post collected up to that moment is safely preserved.

***

### ❓ Frequently Asked Questions (FAQ)

#### Do I need to buy expensive residential proxies to use this Actor?

**No.** Apify Datacenter Proxies are already built-in and included at **$0.00 extra cost**. You do not need to configure external proxy services.

#### Can I scrape X/Twitter without providing cookies or logging in?

**Yes.** For established accounts (e.g. `@NASA`, `@BBC`, `@OpenAI`), single post links, public Twitter lists, and conversation threads, **Free Guest Mode** works out of the box with zero credentials.

#### Why do newer accounts return only 3 to 5 preview posts without cookies?

Twitter's backend enforces a server-side restriction for accounts created recently: unauthenticated visitors are only served a short preview timeline. Our scraper uses **Web SSR fallback** to extract all pre-rendered preview posts. To paginate through the full historical timeline of newer profiles, simply provide your cookies.

#### Are my Twitter cookies safe?

**Yes.** Your cookies are transmitted exclusively to Twitter's official endpoints over encrypted HTTPS connections. They are never stored, logged, or shared with third parties. For extra peace of mind, we recommend using a secondary or dedicated crawling account.

#### How does Pay-Per-Event pricing benefit me over traditional scrapers?

Traditional scrapers charge for every second their browser container runs — meaning if a proxy gets stuck or a search returns 0 results, you still pay for server runtime. With **Pay-Per-Event**, you only pay for actual posts delivered to your dataset ($0.30 per 1,000 posts). If a search returns 0 results, you pay **$0.00**.

#### Can I export data into Excel, CSV, or connect it to an API webhook?

**Yes.** Apify provides 1-click downloads in **Excel (XLSX), CSV, JSON, and XML**. You can also connect the dataset directly to **Google Sheets, Zapier, Make, or custom REST API webhooks**.

***

### 🏷️ Tags & Categories

`twitter-scraper`, `x-scraper`, `tweet-extractor`, `social-media-mining`, `lead-generation`, `sentiment-analysis`, `tweet-data`, `x-com`, `market-research`, `brand-monitoring`, `ai-training-data`

***

### 👨‍💻 Support & Inquiries

Developed and maintained with ❤️ by **codescraper**.

Need assistance, custom feature integrations, or enterprise volume handling?

- **Email:** <codescraper011@gmail.com>
- **Author Profile:** [Apify Store - codescraper](https://apify.com/codescraper)

# Actor input Schema

## `userHandles` (type: `array`):

X (Twitter) handles to scrape posts from without '@' (e.g. 'NASA', 'OpenAI', 'elonmusk').

## `queryTexts` (type: `array`):

Search queries or hashtags (e.g. 'web scraping', 'artificial intelligence', '#AI lang:en', 'from:NASA since:2024-01-01'). Supports full Twitter advanced search syntax.

## `sourceUrls` (type: `array`):

List of X (Twitter) URLs to extract data from (e.g. 'https://x.com/NASA', 'https://x.com/NASA/status/1728108619189874825', 'https://x.com/i/lists/123456').

## `threadIds` (type: `array`):

IDs of conversation threads to scrape all replies from (e.g. '1728108619189874825').

## `twitterCookies` (type: `string`):

Paste your exported X cookies (JSON array from Cookie-Editor, or raw string e.g. 'auth_token=824377ff...; ct0=d68abfb8...').

## `authToken` (type: `string`):

Your X 'auth_token' cookie value (e.g. '824377ff3f6f9f1e581df86f2c537c56c80b3d77'). If entered, overrides cookie textarea.

## `ct0` (type: `string`):

Your X 'ct0' (CSRF token) cookie value (e.g. 'd68abfb81df39f3617f0fad2f1ded925a3d097bc...'). Used with auth_token for secure queries.

## `resultLimit` (type: `integer`):

Maximum number of posts to extract (e.g. 100, 150, 500, 1000). Default is 150 for quick test runs. Leave empty or enter 0 for unlimited results.

## `sortOrder` (type: `string`):

How to sort the results. 'Recent' orders by newest first. 'Popular' orders by engagement.

## `onlyReplies` (type: `boolean`):

When enabled, extracts only reply posts (comments made to other posts). Note: For the complete dedicated Replies tab (/with_replies), add cookies in the Cookies section; otherwise free Guest mode filters the main timeline.

## `onlyReposts` (type: `boolean`):

When enabled, extracts only reposted / retweeted posts.

## `onlyMedia` (type: `boolean`):

When enabled, extracts only posts that contain photos, videos, or GIFs.

## `contentLanguage` (type: `string`):

Filter posts by language using ISO 639-1 codes (e.g., 'en' for English, 'es' for Spanish).

## `verifiedAccountsOnly` (type: `boolean`):

When enabled, only extracts posts from verified accounts.

## `premiumSubscribersOnly` (type: `boolean`):

When enabled, only extracts posts from X Premium (formerly Twitter Blue) subscribers.

## `containsImages` (type: `boolean`):

When enabled, only extracts posts that include image attachments.

## `containsVideos` (type: `boolean`):

When enabled, only extracts posts that include video content.

## `containsLinks` (type: `boolean`):

When enabled, only extracts posts that contain external links.

## `containsPolls` (type: `boolean`):

When enabled, only extracts posts that include polls.

## `quotedPostsOnly` (type: `boolean`):

When enabled, only extracts posts that are quote posts.

## `excludeReposts` (type: `boolean`):

When enabled, filters out reposted/retweeted content from results.

## `excludeReplies` (type: `boolean`):

When enabled, filters out reply posts from results.

## `postedBy` (type: `string`):

Filter posts by a specific author handle without '@' (e.g. 'NASA', 'OpenAI', 'TechCrunch').

## `replyingTo` (type: `string`):

Filter posts that are replies to a specific user without '@' (e.g. 'elonmusk').

## `mentionsUser` (type: `string`):

Filter posts that mention a specific user without '@' (e.g. 'ChatGPTapp', 'sama').

## `minLikes` (type: `integer`):

Only include posts with at least this many likes/favorites (e.g. 50, 100, 500).

## `minReposts` (type: `integer`):

Only include posts with at least this many reposts/retweets (e.g. 10, 25, 100).

## `minReplies` (type: `integer`):

Only include posts with at least this many replies (e.g. 5, 20).

## `minBookmarks` (type: `integer`):

Only include posts with at least this many bookmarks (e.g. 10, 50).

## `minViews` (type: `integer`):

Only include posts with at least this many views/impressions (e.g. 1000, 10000).

## `minAuthorFollowers` (type: `integer`):

Only include posts from authors with at least this many followers (e.g. 5000, 50000).

## `fromDate` (type: `string`):

Only include posts published on or after this date (format: YYYY-MM-DD, e.g. '2026-01-01').

## `toDate` (type: `string`):

Only include posts published on or before this date (format: YYYY-MM-DD, e.g. '2026-12-31').

## `nearLocation` (type: `string`):

Filter posts geotagged near a location (e.g. 'New York', 'San Francisco', 'London').

## `locationRadius` (type: `string`):

Radius around the location to include (e.g. '15mi', '25km').

## `geoCoordinates` (type: `string`):

Filter by coordinates. Format: 'latitude,longitude,radius' (e.g. '37.7749,-122.4194,10mi').

## `placeId` (type: `string`):

Filter posts tagged with a specific X Place ID (e.g. '5a110d312052166f').

## `includeUserAnalytics` (type: `boolean`):

When enabled, includes detailed author profile analytics (follower ratio, account age, verification category).

## `extractHashtags` (type: `boolean`):

When enabled, extracts all hashtags into a separate array field for easy analysis.

## `extractMentions` (type: `boolean`):

When enabled, extracts all mentioned users into a separate array field.

## `extractMediaUrls` (type: `boolean`):

When enabled, extracts all media (images, videos, GIFs) direct URLs into a separate array.

## `extractReplies` (type: `boolean`):

When enabled, also extracts replies/conversation threads for each post found.

## `includeQueryInOutput` (type: `boolean`):

When enabled, adds the search query that found each post to the output data.

## `outputTransformFunction` (type: `string`):

Custom JavaScript function to transform each output object. The function receives the post object and should return the transformed data. Example: (post) => ({ text: post.fullText, likes: post.likesCount })

## Actor input object example

```json
{
  "userHandles": [
    "NASA"
  ],
  "resultLimit": 150,
  "sortOrder": "Recent",
  "onlyReplies": false,
  "onlyReposts": false,
  "onlyMedia": false,
  "verifiedAccountsOnly": false,
  "premiumSubscribersOnly": false,
  "containsImages": false,
  "containsVideos": false,
  "containsLinks": false,
  "containsPolls": false,
  "quotedPostsOnly": false,
  "excludeReposts": false,
  "excludeReplies": false,
  "includeUserAnalytics": true,
  "extractHashtags": true,
  "extractMentions": true,
  "extractMediaUrls": true,
  "extractReplies": false,
  "includeQueryInOutput": false,
  "outputTransformFunction": ""
}
```

# Actor output Schema

## `results` (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 = {
    "userHandles": [
        "NASA"
    ],
    "resultLimit": 150,
    "outputTransformFunction": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("codescraper/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 = {
    "userHandles": ["NASA"],
    "resultLimit": 150,
    "outputTransformFunction": "",
}

# Run the Actor and wait for it to finish
run = client.actor("codescraper/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 '{
  "userHandles": [
    "NASA"
  ],
  "resultLimit": 150,
  "outputTransformFunction": ""
}' |
apify call codescraper/x-tweet-scraper --silent --output-dataset

```

## MCP server setup

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