# X (Twitter) Profile & Tweets Scraper — Bio, Engagement Data (`nick.cheng/x-twitter-profile-tweets-scraper`) Actor

Scrape X (Twitter) profiles and tweets by handle, URL or user ID — bio, follower counts, likes, retweets, replies, views. Filter tweets by likes or views, run incrementally, look up single tweets by URL. Profiles and tweet lookups need no login; full timelines use your cookies. Pay only for results.

- **URL**: https://apify.com/nick.cheng/x-twitter-profile-tweets-scraper.md
- **Developed by:** [Nicholas Cheng](https://apify.com/nick.cheng) (community)
- **Categories:** Social media, Developer tools, MCP servers
- **Features:** Limited permissions
- **Stats:** 86 total users, 20 monthly users, 99.5% 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.
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) Profile & Tweets Scraper

**Give it a handle, get back that account's profile and tweets as clean JSON.** Profiles and single tweets need no login, no cookies, no API key and no proxy configuration. X now shows logged-out visitors only the latest few posts of an account, so for full timelines you add the cookies of a logged-in X session — optional, encrypted, and used for nothing else. Point it at `nasa`, `https://x.com/openai`, or a numeric user ID, and it returns structured records you can drop straight into a database or feed to an agent.

**You are charged only for results that actually came back.** No mock rows, no placeholder padding, no minimum charge on a run that found nothing. If an account is suspended, protected, or does not exist, the run reports why and charges you nothing for it.

| | |
|---|---|
| **Input** | X / Twitter handles, profile URLs, or numeric user IDs |
| **Output** | Tweets (text, metrics, media, mentions, links) + enriched author profiles |
| **Price** | $0.005 per account + $0.0003 per tweet ($0.30 per 1,000) |
| **Login required** | **Not for profiles or single tweets.** Full timelines need optional login cookies — X shows logged-out visitors only an account's latest few posts |
| **Single tweets** | Yes — by URL or ID, $0.005 each, author profile embedded |
| **Incremental runs** | Yes — pick up where the last run left off, for 15-minute schedules |
| **Filters** | Likes, reposts, replies, views, text length, keywords, regex — filtered-out tweets are not charged |
| **Keyword search** | **Not supported.** See [What this Actor cannot do](#what-this-actor-cannot-do) |

***

### What you get

#### Tweets

Every tweet record carries the text (including full long-form posts, which many scrapers truncate at 280 characters), timestamps, all six engagement counters, and fully expanded entities:

```json
{
  "itemType": "tweet",
  "type": "tweet",
  "id": "2090487779268407625",
  "url": "https://x.com/NASA/status/2090487779268407625",
  "text": "Our Artemis II crew is one step closer to the Moon.",
  "isLongform": false,
  "lang": "en",
  "createdAt": "2026-08-19T14:02:11.000Z",
  "source": null,
  "replyCount": 412, "retweetCount": 3105, "quoteCount": 188,
  "likeCount": 24907, "bookmarkCount": 601, "viewCount": 1840233,
  "conversationId": null,
  "isRetweet": false, "isQuote": false, "isReply": false,
  "hashtags": ["Artemis"],
  "cashtags": [],
  "mentions": [{ "userName": "NASAArtemis", "userId": "1050393...", "name": "NASA Artemis" }],
  "urls": ["https://www.nasa.gov/artemis-ii/"],
  "media": [{ "type": "photo", "url": "https://pbs.twimg.com/media/...jpg", "altText": "Four astronauts in orange flight suits" }],
  "authorUserName": "NASA",
  "author": { "...full profile, see below..." }
}
```

Retweets and quote tweets keep their lineage — `retweetedTweetId`, `retweetedAuthor`, `quotedTweetId`, `quotedText` — so you can tell original content from amplification without a second pass.

#### Profiles

The profile record goes past the usual follower-count-and-bio. These fields come straight from X's own account metadata; none of them are guessed, inferred, or generated by a language model:

| Field | Why it matters |
|---|---|
| `verifiedType` | `Government`, `Business`, or blank — separates official accounts from paid blue checks |
| `verifiedSince` | Exact ISO timestamp the account was verified |
| `parodyCommentaryFanLabel` | X's mandatory label for parody / commentary / fan accounts — a direct impersonation signal |
| `affiliatesCount` | How many sub-accounts a business account has under it |
| `professionalCategory` | Self-declared business category for professional accounts |
| `tipjar` | Bitcoin, Ethereum, PayPal, Venmo, Cash App, Patreon, GoFundMe and Bandcamp handles the account has published |
| `birthdate` | Publicly published birthdate, with its visibility setting |
| `isProtected`, `hasGraduatedAccess`, `possiblySensitive` | Account state flags |

Plus the standard set: `userId`, `name`, `description`, `descriptionUrls` (expanded, not `t.co`), `website`, `location`, `createdAt`, `followers`, `following`, `tweetsCount`, `mediaCount`, `favouritesCount`, `isBlueVerified`, `profilePicture` (full resolution), `coverPicture`.

**Since X rebuilt its web app in October 2026**, some of these are no longer sent to logged-out visitors and come back as `null`: `verifiedSince`, `verifiedReason`, `isIdentityVerified`, `parodyCommentaryFanLabel`, `professionalCategory`, `tipjar`, `mediaCount`, `favouritesCount`, `canDm`, `hasGraduatedAccess`. On tweets, `source` and `conversationId` are `null` for the same reason. The fields stay in the output so existing pipelines keep working; nothing is filled in by guesswork.

***

### Input

```json
{
  "twitterHandles": ["nasa", "openai"],
  "startUrls": [{ "url": "https://x.com/elonmusk" }],
  "maxTweetsPerProfile": 200,
  "includeRetweets": false,
  "since": "2026-01-01"
}
```

| Option | Default | Notes |
|---|---|---|
| `twitterHandles` | — | With or without `@` |
| `startUrls` | — | Any `x.com/<handle>` or `twitter.com/<handle>` URL. A tweet link pasted here is looked up as a single tweet |
| `userIds` | — | Numeric IDs, immune to username changes |
| `tweetUrls` | — | Single tweets by link (`x.com/<handle>/status/<id>`) or numeric ID — see [Looking up single tweets](#looking-up-single-tweets-by-url-or-id) |
| `maxTweetsPerProfile` | `100` | `0` fetches the profile only |
| `maxItems` | `0` | Hard cap across the whole run — bounds your spend |
| `scrapeProfilesOnly` | `false` | Cheapest mode for bulk account enrichment |
| `cookies` | — | Optional. `auth_token` and `ct0` of a logged-in X session, for timelines beyond the latest few posts. Secret input |
| `includeReplies` | `true` | |
| `includeRetweets` | `true` | |
| `onlyWithMedia` | `false` | |
| `since` / `until` | — | ISO dates; `since` also stops pagination early, so it makes runs cheaper |
| `minLikes` / `minRetweets` / `minReplies` / `minViews` | `0` | Engagement floors — see [Filtering](#filtering-by-engagement-or-text) |
| `minTextLength` | `0` | Drop one-word replies |
| `textContains` / `excludeTextContains` | — | Keyword lists, case-insensitive |
| `textRegex` | — | JavaScript regex, case-insensitive |
| `incremental` | `false` | Fetch only tweets newer than the previous run — see [Incremental runs](#incremental-runs-pick-up-where-you-left-off) |
| `stateStoreName` | `x-scraper-state` | Where the per-account watermark is kept |
| `sinceId` | — | Manual watermark: skip tweets at or below this ID |
| `includeAuthorProfile` | `true` | Turn off for a slimmer dataset |

***

### Pricing

Pay-per-event. You pay for what came back, nothing else.

| Event | Price | What it covers |
|---|---|---|
| `profile-scraped` | **$0.005** per account | Looking the account up and returning its enriched profile. Charged once per account. |
| `tweet-scraped` | **$0.0003** per tweet | Each tweet returned from that account's timeline — $0.30 per 1,000. |
| `tweet-looked-up` | **$0.005** per tweet | One tweet fetched on its own by URL or ID, with its author profile embedded. Same price as an account lookup, because it is the same amount of work: one targeted request, one record back. |

Two events instead of one flat per-row price, because the work is shaped that way: resolving an
account costs the same whether you then pull 10 tweets from it or 2,000. Splitting it out is what
lets the per-tweet rate stay at $0.30/1K instead of being marked up to subsidise account lookups.

**What it works out to**, against the closest comparable Actor on the Store, which charges
$0.016 per profile plus $0.0004 per tweet:

| You want | Here | Closest comparable |
|---|---|---|
| 1 account, 10 tweets *(monitoring)* | **$0.008** | $0.016 |
| 1 account, 100 tweets | **$0.035** | $0.040 |
| 1 account, 2,000 tweets *(archive)* | **$0.605** | $0.800 |
| 10 accounts, 200 tweets each | **$0.650** | $0.920 |

Cheaper than that one at every volume, not just at the volume that makes the table look good.

Being straight about the rest of the field: a few Actors run a flat per-tweet rate slightly below
this one and come out ahead on very large single-account pulls. They are also doing keyword search,
which means they are driving a pool of logged-in accounts. That is a different tool with a different
failure mode — see [What this Actor cannot do](#what-this-actor-cannot-do).

Three commitments:

1. **Real results only.** Every charged row is data that came back from X. Padding a thin result set with placeholder rows and billing for them is a thing that happens in this category; it does not happen here.
2. **Failures are free.** Suspended, deleted, protected, or misspelled accounts produce an explanatory row and cost nothing — including the account lookup fee.
3. **No plan discrimination.** Free-plan runs get the same code path, the same data, and the same reliability as everyone else.

> There is a $0.01 floor on the run budget you can set. That is a floor on the *budget cap*, not a
> minimum charge — a run that returns one profile still costs you $0.005.

#### What you are not charged for

Those three commitments are not abstract. Each one names a specific thing that this Actor does
not do, and every item below is checkable against a run log:

| | What happens here |
|---|---|
| **Empty or placeholder rows** | A tweet that arrives with an ID but no text, no timestamp, and no metrics is not a result. It is dropped before it reaches the dataset, so it is never billed. |
| **Runs that find nothing** | A suspended, deleted, protected, or misspelled account produces one explanatory row marked `chargedForThis: false`. The account fee is not charged either. |
| **Runs where X serves nothing** | If X returns no usable data for any target (a page-format change or a temporary block), the run ends as **FAILED** with the reason instead of an empty "success", so your schedule or integration notices. Nothing is billed. |
| **The free plan** | Same code path, same fields, same page depth. No demo mode, no 10-row cap, no fields blanked out for free users. |
| **Plan-tiered pricing** | $0.005 per account and $0.0003 per tweet on **every** Apify plan — Free, Bronze, Silver, Gold, Platinum, Diamond. Check the Pricing tab: all six columns are identical. |

That last row is worth checking on any Actor you are comparing, including this one. The Pricing
tab shows the per-plan breakdown, and the number a listing advertises in its title is not always
the number a free-plan run pays.

#### Many accounts, few tweets each

If you are monitoring a set of accounts rather than archiving one, you want a cap that applies
**per account**, in a single run. That is the default here:

```json
{
  "twitterHandles": ["NASA", "NASAHubble", "NASAWebb", "NASAPersevere", "NASAMars"],
  "maxTweetsPerProfile": 3,
  "since": "2026-06-01"
}
```

One run, five accounts, at most three tweets each, nothing older than the cutoff. Real output:

```
NASA            profile + 3 tweets
NASAHubble      profile + 3 tweets
NASAWebb        profile + 3 tweets
NASAMars        profile + 3 tweets
NASAPersevere   profile + 0 tweets   ← nothing past the cutoff, so nothing billed
                                       charged: 12 tweets, 5 accounts = $0.0286
```

`since` / `until` filter on the tweet timestamp and stop paging once the timeline passes the
cutoff, so a narrow window costs less than a wide one rather than the same.

#### Filtering by engagement or text

Filters run before a tweet is written to the dataset, and **a tweet that does not pass is not
charged**. Paging keeps going until the per-profile cap is met with tweets that do pass, or the
timeline runs out.

```json
{
  "twitterHandles": ["NASA", "SpaceX", "ESA"],
  "maxTweetsPerProfile": 10,
  "minLikes": 1000,
  "minViews": 100000,
  "excludeTextContains": ["giveaway"],
  "textRegex": "\\b(launch|liftoff|landing)\\b"
}
```

| Filter | What it does |
|---|---|
| `minLikes`, `minRetweets`, `minReplies`, `minViews` | Engagement floors. `0` means off. |
| `minTextLength` | Drops one-word replies and bare links. |
| `textContains` | Keep if the text contains **any** of the phrases (case-insensitive). |
| `excludeTextContains` | Drop if the text contains any of the phrases. |
| `textRegex` | JavaScript regex, case-insensitive, against the full text (long-form posts included). |

The run summary reports `filteredOut` so you can see how many tweets were read and dropped.

#### Incremental runs: pick up where you left off

If you run this on a schedule — every 15 minutes, every hour — you do not want to re-fetch and
re-pay for the same timeline each time. Turn on `incremental`:

```json
{
  "twitterHandles": ["NASA", "SpaceX", "ESA"],
  "maxTweetsPerProfile": 50,
  "incremental": true,
  "stateStoreName": "space-agencies"
}
```

The first run behaves normally and records, per account, the ID of the newest tweet it saw. Every
later run stops paging the moment it reaches that tweet, so an account with nothing new costs one
account lookup and zero tweets. The watermark lives under the key `LAST_SEEN` in a key-value store
named `stateStoreName` **in your own Apify account** — you can read it, edit it, or delete it to
start over. Use a different store name per watchlist so schedules do not interfere.

The watermark is the tweet **ID**, not a timestamp. Tweet IDs increase with time, and pinned tweets
(which sit at the top of a timeline regardless of age) are ignored for the watermark, so a pinned
post from 2019 does not fool the resume logic.

If you would rather manage state yourself, every run writes `newestTweetIdByAccount` to its
`SUMMARY` record. Pass the value back as `sinceId` on the next run and you get the same behaviour
without the store.

#### Looking up single tweets by URL or ID

Sometimes you have tweet links, not accounts — a list of posts to fact-check, a set of URLs
collected from somewhere else, a tweet someone sent you. Pass them as `tweetUrls`:

```json
{
  "tweetUrls": [
    "https://x.com/NASA/status/2090487779268407625",
    "1234567890123456789"
  ]
}
```

Each tweet is fetched individually — no timeline walk — and returned as a normal tweet record with
`lookedUp: true` and a compact author profile embedded (X's post page carries the author's name,
bio, counts and verification, but not location, website or join date — use `twitterHandles` for those). This is the same data shape as timeline
tweets, so the two mix in one dataset. A deleted, protected, or withheld tweet produces a row marked
`chargedForThis: false` and costs nothing.

What it does **not** do: fetch the replies under a tweet, the accounts that liked it, or the quote
tweets pointing at it. X does not expose those to logged-out clients.

***

### What this Actor cannot do

Being straight about this up front so you do not buy the wrong tool:

- **No keyword or hashtag search** and **no followers / following lists.** Not offered.
- **Full timelines without login.** X shows logged-out visitors only an account's latest few original posts, with no way to page further. Pass `cookies` from a logged-in session to get the rest. Timelines come from the profile's Posts tab (the account's original posts).
- **No reply threads, likers, or bookmarkers** of a tweet. A single tweet by URL or ID — yes (see above); the conversation under it — no.
- **Protected accounts** return their profile only. Their tweets are not public, and no scraper can change that.

Profiles and single tweets work with no login at all. Timeline pages beyond the first few posts use the cookies you supply and nothing else — the Actor never logs in on its own and never uses anyone else's account.

***

### How it stays working

In October 2026 X rebuilt its web app: profile and post pages are now rendered on X's servers with the data embedded in the page. This Actor reads that embedded data directly — one page per account or tweet, no API key, no guest token, no browser.

The internal query identifiers needed to page timelines are read from the same page on every run, so when X rotates them the Actor picks up the new ones by itself instead of failing silently. That repair path is plain parsing — deterministic, auditable, and with no language model anywhere in the data path, so your output cannot drift between runs.

***

### FAQ

**Do I need a Twitter/X API key?**
No. There is no key, no developer account, and no OAuth app to register.

**Do I need to supply cookies or a logged-in session?**
Not for profiles or single tweets. For full timelines, yes: X shows logged-out visitors only an account's latest few posts. Paste the `auth_token` and `ct0` cookies of a logged-in session into `cookies` (secret input, stored encrypted, used only for timeline requests). Use a secondary account — X can rate-limit or lock accounts that read heavily.

**Do I need proxies?**
No. Proxy configuration is not an input because the Actor does not need one.

**Can I run this every 15 minutes and only get new tweets?**
Yes. Turn on `incremental`. Each account stops at the newest tweet the previous run saw, so an account with nothing new costs one lookup and no tweets. See [Incremental runs](#incremental-runs-pick-up-where-you-left-off).

**Can I filter by likes or views before paying?**
Yes. `minLikes`, `minViews` and the other filters are applied before a tweet is written, and tweets that do not pass are not charged.

**Can I scrape one tweet by its URL?**
Yes — pass it in `tweetUrls`. $0.005 per tweet returned, with the author profile embedded.

**How many tweets can I get from one account?**
The timeline pages back roughly 15–20 tweets at a time and keeps going. Set `maxTweetsPerProfile` to whatever you need; use `since` when you only care about a recent window.

**Can I get tweets older than the timeline goes back?**
X's own timeline is the ceiling. For deep historical archives you want a data provider, not a scraper.

**What happens if X changes something?**
Query identifier rotation is handled automatically (see above). Structural changes are not, and would need an update — if output looks wrong, open an issue on the Actor and it gets fixed.

**Is scraping X legal?**
Scraping publicly accessible pages has been treated differently from accessing a computer without authorization — see *hiQ Labs v. LinkedIn*, where the Ninth Circuit held that scraping public profiles did not violate the Computer Fraud and Abuse Act. That said, this is general background and not legal advice: platform terms, your jurisdiction, and what you do with the data all matter, and personal data carries its own obligations under GDPR and similar regimes. Get advice for your own situation.

***

### Integrating

Every Apify Actor exposes a REST API, so you can start a run and read results from any language:

```bash
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/run-sync-get-dataset-items?token=<TOKEN>" \
  -H 'Content-Type: application/json' \
  -d '{"twitterHandles":["nasa"],"maxTweetsPerProfile":50}'
```

Official clients exist for JavaScript and Python, and results can be exported as JSON, CSV, or Excel, or pushed onward through Apify integrations.

# Actor input Schema

## `twitterHandles` (type: `array`):

Usernames to scrape, with or without the @ (e.g. "nasa", "@openai"). This is the fastest way to target accounts. Defaults to a single well-known account so a run with no input still returns data.

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

Profile URLs such as https://x.com/nasa. Handy when your source system already stores links rather than handles.

## `userIds` (type: `array`):

Numeric X user IDs (e.g. "11348282"). Use these when you need results that survive a username change.

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

Individual tweets to look up: links like https://x.com/nasa/status/1234567890 or bare numeric tweet IDs. Each one is fetched on its own and returned with a compact author profile embedded — no timeline is walked, no login needed. Charged $0.005 per tweet returned; deleted, protected or withheld tweets cost nothing.

## `maxTweetsPerProfile` (type: `integer`):

How many tweets to pull from each account's timeline. Set to 0 to fetch profiles only. Without login cookies X shows only each account's latest few posts, so higher values need the cookies field below. You are charged only for tweets actually returned.

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

Hard cap across the whole run, counting every profile and tweet pushed. 0 means no cap. Use it to bound spend on large input lists.

## `scrapeProfilesOnly` (type: `boolean`):

Return one enriched profile record per account and fetch no timelines at all. The cheapest mode for bulk account enrichment.

## `cookies` (type: `string`):

X shows logged-out visitors only the latest few posts of each account. To page through full timelines, paste the auth_token and ct0 cookies of a logged-in X session, as "auth_token=...; ct0=..." or the JSON array a cookie-export browser extension produces. Used only to fetch timeline pages; profiles and single-tweet lookups never need it. Stored encrypted. Use a secondary account: X may rate-limit or lock accounts that read heavily.

## `includeReplies` (type: `boolean`):

Keep the account's replies. Turn off to get only standalone posts.

## `includeRetweets` (type: `boolean`):

Keep reposts of other accounts. Turn off to get only the account's own content.

## `onlyWithMedia` (type: `boolean`):

Keep only tweets carrying a photo, video, or GIF.

## `since` (type: `string`):

ISO date or datetime, e.g. 2026-01-01. Timelines are walked newest-first and stop once they pass this date, so a tight range also makes the run cheaper. Reaching back past an account's latest few posts needs login cookies.

## `until` (type: `string`):

ISO date or datetime, e.g. 2026-06-30. Tweets newer than this are skipped.

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

Keep only tweets with at least this many likes. 0 means no minimum. Filtered-out tweets are not delivered and not charged; paging continues until the per-profile cap is met with tweets that pass.

## `minRetweets` (type: `integer`):

Keep only tweets with at least this many reposts (retweets). 0 means no minimum.

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

Keep only tweets with at least this many replies. 0 means no minimum.

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

Keep only tweets with at least this many views. 0 means no minimum.

## `minTextLength` (type: `integer`):

Keep only tweets whose text is at least this many characters. Useful for dropping one-word replies. 0 means no minimum.

## `textContains` (type: `array`):

Keep only tweets whose text contains at least one of these words or phrases, case-insensitive. Leave empty to keep all.

## `excludeTextContains` (type: `array`):

Drop tweets whose text contains any of these words or phrases, case-insensitive.

## `textRegex` (type: `string`):

Keep only tweets whose text matches this JavaScript regular expression (case-insensitive). Example: \b(launch|liftoff)\b

## `incremental` (type: `boolean`):

Remember the newest tweet seen for every account (in a key-value store in your Apify account) and, on the next run, stop as soon as that tweet is reached. Lets a scheduled run every 15 or 30 minutes fetch only what is new instead of re-fetching the whole timeline. The first run behaves normally and seeds the state. Works without cookies as long as each account posts no more than a few times between runs.

## `stateStoreName` (type: `string`):

Name of the key-value store that holds the per-account watermark (key LAST_SEEN). Use a different name per watchlist so schedules do not interfere with each other. Created automatically.

## `sinceId` (type: `string`):

Manual watermark: skip every tweet with an ID at or below this one and stop paging once it is reached. Works without incremental mode — read newestTweetIdByAccount from the previous run's SUMMARY and pass it here.

## `includeAuthorProfile` (type: `boolean`):

Attach the full author record to every tweet. Turn off for a slimmer dataset when you already store profiles separately.

## Actor input object example

```json
{
  "twitterHandles": [
    "nasa",
    "openai"
  ],
  "maxTweetsPerProfile": 100,
  "maxItems": 0,
  "scrapeProfilesOnly": false,
  "includeReplies": true,
  "includeRetweets": true,
  "onlyWithMedia": false,
  "minLikes": 0,
  "minRetweets": 0,
  "minReplies": 0,
  "minViews": 0,
  "minTextLength": 0,
  "incremental": false,
  "stateStoreName": "x-scraper-state",
  "includeAuthorProfile": true
}
```

# Actor output Schema

## `tweets` (type: `string`):

One row per tweet, with full text (long-form posts are not truncated), engagement counters, media, mentions, hashtags and expanded links.

## `profiles` (type: `string`):

One row per account, including deterministic fields most scrapers omit: verification type and date, parody/commentary/fan label, affiliate count, published tipjar handles.

## `allItems` (type: `string`):

The complete dataset in one call. Each row carries an itemType field of either 'tweet' or 'profile'.

## `runSummary` (type: `string`):

What was scraped, what could not be scraped and why, and exactly how many billable events were charged.

# 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 = {
    "twitterHandles": [
        "nasa",
        "openai"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nick.cheng/x-twitter-profile-tweets-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 = { "twitterHandles": [
        "nasa",
        "openai",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("nick.cheng/x-twitter-profile-tweets-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 '{
  "twitterHandles": [
    "nasa",
    "openai"
  ]
}' |
apify call nick.cheng/x-twitter-profile-tweets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nick.cheng/x-twitter-profile-tweets-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/3dJpgbL5FEG0QYkSM/builds/2eOsXWMFLfgzhgytA/openapi.json
