# Twitter (X) Scraper — Tweets, Search, Timelines & Full Metrics (`brilliant_gum/twitter-x-scraper`) Actor

Scrape tweets by keyword, advanced query, hashtag, user timeline or tweet ID. Every tweet with views, bookmarks and the full author profile. No login, no API key.

- **URL**: https://apify.com/brilliant\_gum/twitter-x-scraper.md
- **Developed by:** [Yuliia Kulakova](https://apify.com/brilliant_gum) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 3 total users, 2 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0015 / tweet

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## X / Twitter Scraper — real-time keyword, advanced-query, timeline & tweet scraper, no login

Search X (Twitter) by keyword, hashtag or the **full advanced-search grammar**, scrape user timelines and individual tweets, and export every tweet with **complete engagement metrics — including view count and bookmark count** — as structured JSON or CSV. **No login, no API key, no browser.** Pay only for the results you get.

![Twitter (X) Scraper — Tweets, Search, Timelines & Full Metrics](https://api.apify.com/v2/key-value-stores/IuFu0Cw6PpOkNkDV7/records/twitter-x-scraper-banner)

***

### What it does

- **Search tweets** by keyword, hashtag, or a full X advanced-search query (`from:`, `to:`, `since:`, `until:`, `min_faves:`, `lang:`, `filter:*`, and more).
- **Scrape user timelines** — pull the recent tweets of any public account by handle.
- **Look up individual tweets** by URL or ID, hydrated to full fidelity.
- **Capture full metrics** on every record: likes, retweets, replies, quotes, **bookmarks**, and **views** — plus the complete author profile, media, polls, quoted/retweeted tweets, and X Articles.
- **Monitor keywords** across scheduled runs and emit only tweets that are new since the last run.

All of this runs **without any X account or API key** for standard use, through a resilient no-login backend with automatic residential-IP rotation.

***

### Key features

- **Real-time keyword search, no login.** X gates its own search endpoint behind a logged-in session. This Actor gets your query executed **server-side against X**, so the **full advanced-search operator grammar is honored by X itself** — not stripped or re-applied client-side. Results are **real-time and full-fidelity**, with deep pagination.
- **Complete metrics, including `viewCount` and `bookmarkCount`.** Many competing scrapers omit view and bookmark counts. Every full-fidelity record here carries `likeCount`, `retweetCount`, `replyCount`, `quoteCount`, `bookmarkCount`, and `viewCount`, plus derived `totalEngagement` and `engagementRate`.
- **Full advanced-search operators, applied server-side.** Pass raw queries like `from:OpenAI min_faves:1000` directly, or build them from structured inputs (`minFaves`, `lang`, `sinceDate`/`untilDate`, `filterMedia`, `filterVerified`, …). Operators are compiled into the query and executed by X.
- **Complete author object.** Every tweet embeds the full author: handle, name, verification (`verified`, `blueVerified`, `verifiedType`), follower/following/tweet counts, bio, location, avatar, banner, and more.
- **Nested quoted & retweeted tweets.** `quotedTweet` and `retweetedTweet` are fully normalized to the same schema.
- **Polls, X Articles, and cards.** Structured `poll` (options, votes, end time), structured `article` (title, preview, cover image, blocks) for long-form X Articles, and a `card` reference.
- **`type` field** (`tweet` / `reply` / `retweet` / `quote`) for drop-in parity with other popular tweet scrapers.
- **Keyword-monitoring mode.** `monitorMode` + `sinceLastRun` keep a `LAST_RUN` marker in the key-value store, so scheduled runs return only tweets newer than the previous run.
- **Pay-per-result pricing that undercuts competitors** — roughly **$0.15–$0.20 per 1,000 tweets** versus ~$0.40 elsewhere, and ~30x cheaper than the official X API (~$5/1K). Empty and duplicate results bill nothing.
- **No-login by design.** Automatic per-request IP rotation and layered fallbacks deliver results without credentials. An optional authenticated-session mode is available for the highest-volume jobs.

***

### Input

Configure the run from the Apify Console UI or via the JSON input. All fields are optional — supply at least one query mode (`searchTerms`, `hashtags`, `rawQuery`, `tweetUrls`, `tweetIds`, `fromUsers`, …).

#### Query modes

| Field | Type | Description |
|---|---|---|
| `searchTerms` | array\<string> | One or more search queries. Each item accepts the **full X advanced-search syntax** (e.g. `openai lang:en min_faves:100`). Real-time & full-fidelity with no login. |
| `hashtags` | array\<string> | Hashtags to search (with or without `#`). Each becomes its own search query. |
| `rawQuery` | string | A single raw X advanced-search query, used **verbatim** (structured operators below are not appended to it). |
| `tweetUrls` | array\<string> | Status URLs (`https://x.com/<user>/status/<id>`), resolved and looked up at full fidelity. |
| `tweetIds` | array\<string> | Numeric tweet IDs to look up directly. |
| `fromUsers` | array\<string> | Handles (without `@`) whose recent tweets to pull via user-timeline. |
| `toUser` | string | Only tweets replying to this handle (compiled to `to:`; search — best with auth). |
| `mentioning` | array\<string> | Tweets mentioning these handles (search — best with auth). |

#### Advanced-search operators (compiled into the query)

| Field | Type | Compiles to |
|---|---|---|
| `sinceDate` / `untilDate` | string `YYYY-MM-DD` | `since:` / `until:` |
| `sinceTime` / `untilTime` | integer (unix sec) | `since_time:` / `until_time:` (more reliable) |
| `sinceId` / `maxId` | string | `since_id:` / `max_id:` |
| `lang` | string | `lang:` |
| `minFaves` / `minRetweets` / `minReplies` | integer | `min_faves:` / `min_retweets:` / `min_replies:` |
| `geocode` | string `lat,long,radius` | `geocode:` |
| `near` + `withinRadius` | string | `near:` + `within:` |
| `placeId` | string | `place:` |

#### Content toggles

`filterMedia`, `filterImages`, `filterVideos`, `filterLinks`, `filterVerified`, `filterBlue`, `filterQuote`, `filterNativeRetweet` (booleans → `filter:*`), plus `includeReplies` / `includeRetweets` / `includeQuotes` (default `true`; set `false` to exclude via `-filter:*`).

#### Controls

| Field | Type | Default | Description |
|---|---|---|---|
| `sort` | enum | `Top` | Which results to return. `Top` gives tweets with real engagement numbers; `Latest` returns tweets posted seconds ago, whose counts are still zero. Also `Photos`, `Videos`. |
| `maxTweetsPerTerm` | integer | `100` | Cap of tweets per query/term/timeline. |
| `maxTotalTweets` | integer | `1000` | Global cap across all jobs in the run. |
| `outputPreset` | enum | `full` | Record shape: `full`, `compact`, or `csvFlat`. |
| `jqFilter` | string | — | Optional dot-path projection (e.g. `.text`). |
| `monitorMode` | boolean | `false` | Keyword-monitoring run (pairs with `sinceLastRun`). |
| `sinceLastRun` | boolean | `false` | With `monitorMode`: emit only tweets newer than the previous run. |
| `authToken` | string (secret) | — | Optional `auth_token` cookie from a logged-in x.com session — unlocks authenticated search at scale. |
| `csrfToken` | string (secret) | — | Optional `ct0` cookie, required alongside `authToken`. |
| `timelineFallback` | boolean | `true` | Keep on. Lets a user timeline fall back to a secondary source if the main one fails. |
| `fxSearch` | boolean | `true` | Primary real-time keyword search. Leave on. |
| `serpFallback` | boolean | `true` | Keep the secondary search path enabled for when the primary one is rate-limited. Leave on. |
| `proxyConfiguration` | object | RESIDENTIAL / US | Apify proxy. Residential is strongly recommended for X. |

#### Input examples

**1. Keyword search (top results)**

```json
{
  "searchTerms": ["openai"],
  "sort": "Top",
  "maxTweetsPerTerm": 100,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "US" }
}
```

**2. Advanced query — high-engagement tweets from a specific account**

```json
{
  "searchTerms": ["from:OpenAI min_faves:1000"],
  "sort": "Latest",
  "maxTweetsPerTerm": 200
}
```

The same query can be built from structured inputs instead of raw operators:

```json
{
  "fromUsers": [],
  "searchTerms": ["gpt"],
  "minFaves": 1000,
  "lang": "en",
  "sinceDate": "2026-08-01",
  "filterMedia": true,
  "sort": "Top"
}
```

**3. User timelines**

```json
{
  "fromUsers": ["OpenAI", "sama"],
  "maxTweetsPerTerm": 50,
  "includeReplies": false
}
```

***

### Output

Every tweet is normalized to one unified schema regardless of source path. Results are pushed to the run's dataset and can be exported as JSON, CSV, Excel, or JSONL.

#### Trimmed sample record

```json
{
  "id": "1839000000000000000",
  "url": "https://x.com/OpenAI/status/1839000000000000000",
  "twitterUrl": "https://twitter.com/OpenAI/status/1839000000000000000",
  "text": "We're rolling out new features today. Here's what's new →",
  "fullText": "We're rolling out new features today. Here's what's new →",
  "createdAt": "2026-08-28T15:42:10.000Z",
  "lang": "en",
  "source": "Twitter Web App",
  "likeCount": 4820,
  "retweetCount": 612,
  "replyCount": 388,
  "quoteCount": 141,
  "bookmarkCount": 1290,
  "viewCount": 512340,
  "isReply": false,
  "isRetweet": false,
  "isQuote": false,
  "type": "tweet",
  "isPinned": false,
  "conversationId": null,
  "inReplyToId": null,
  "inReplyToUserId": null,
  "inReplyToUsername": null,
  "quotedTweet": null,
  "retweetedTweet": null,
  "hashtags": [],
  "mentions": [],
  "urls": [
    { "url": "https://t.co/abc123", "expandedUrl": "https://openai.com/blog", "displayUrl": "openai.com/blog" }
  ],
  "cashtags": [],
  "media": [
    {
      "type": "photo",
      "url": "https://pbs.twimg.com/media/Gxxxxxxx.jpg",
      "previewUrl": "https://pbs.twimg.com/media/Gxxxxxxx.jpg",
      "altText": null,
      "duration": null
    }
  ],
  "card": null,
  "poll": null,
  "article": null,
  "place": null,
  "geo": null,
  "possiblySensitive": false,
  "metricsDegraded": false,
  "author": {
    "id": "4398626122",
    "handle": "OpenAI",
    "name": "OpenAI",
    "verified": false,
    "blueVerified": false,
    "verifiedType": "organization",
    "followers": 4200000,
    "following": 12,
    "tweetCount": 3900,
    "favouritesCount": 120,
    "statusesCount": 3900,
    "mediaCount": 640,
    "listedCount": null,
    "createdAt": "2015-12-06T00:00:00.000Z",
    "description": "Creating safe AGI that benefits all of humanity.",
    "profileBio": "Creating safe AGI that benefits all of humanity.",
    "location": "San Francisco, CA",
    "protected": false,
    "avatarUrl": "https://pbs.twimg.com/profile_images/xxxx.jpg",
    "bannerUrl": "https://pbs.twimg.com/profile_banners/xxxx",
    "pinnedTweetIds": [],
    "entities": null
  },
  "totalEngagement": 5961,
  "engagementRate": 0.011634,
  "searchTerm": "openai",
  "source_path": "search"
}
```

*Illustrative record showing the exact field names and structure produced by the normalizer; live values vary by tweet.*

#### Field reference

- **Identity & content:** `id`, `url`, `twitterUrl`, `text`, `fullText`, `createdAt` (ISO 8601), `lang`, `source`.
- **Metrics:** `likeCount`, `retweetCount`, `replyCount`, `quoteCount`, `bookmarkCount`, `viewCount`, plus derived `totalEngagement` and `engagementRate`.
- **Type & flags:** `type` (`tweet`/`reply`/`retweet`/`quote`), `isReply`, `isRetweet`, `isQuote`, `isPinned`, `possiblySensitive`.
- **Threading:** `inReplyToId` and `inReplyToUsername` on every record; `conversationId` and `inReplyToUserId` on tweet lookups and timelines.
- **Nested tweets:** `quotedTweet`, `retweetedTweet` (same schema, recursively).
- **Entities:** `hashtags[]`, `mentions[]`, `urls[]` (expanded), `cashtags[]`, `media[]` (`type`, `url`, `previewUrl`, `altText`, `duration`).
- **Rich content:** `card`, `poll` (`options[]` with `position`/`label`/`votes`, `totalVotes`, `durationMinutes`, `endDatetime`, `lastUpdated`, `votesAreFinal`), `article` (`title`, `previewText`, `coverImageUrl`, `blocks[]`).
- **Geo:** `place`, `geo` — published on tweet lookups and timelines; keyword-search records carry `null`.
- **Author:** `author{ id, handle, name, verified, blueVerified, verifiedType, followers, following, tweetCount, favouritesCount, statusesCount, mediaCount, listedCount, createdAt, description, profileBio, location, protected, avatarUrl, bannerUrl, pinnedTweetIds[], entities }`.
- **Provenance:** `searchTerm`, `source_path` (which internal pipeline produced the record), and `metricsDegraded` (`true` only on the rare degraded-fallback record where bookmark/quote/view are unavailable; `false` on every full-fidelity record).

**Output presets:** `full` returns everything above. `compact` keeps `id`, `url`, `text`, `createdAt`, author handle, and core metrics. `csvFlat` flattens author and metric fields to a single level for clean CSV export.

***

### Pricing

**Pay-per-result — $1.50 per 1,000 tweets.** You are billed only for tweets actually returned. Duplicates are removed before billing, and a run that returns nothing costs nothing.

That is roughly **3x cheaper than the official X API** (~$5 per 1,000 posts), and every tweet arrives with the full engagement picture — including `bookmarkCount` and `viewCount`, which most alternatives omit entirely — plus the complete author profile, nested quoted tweets, and the advanced-search operator grammar executed server-side by X.

| What you pull | Cost |
|---|---|
| 1,000 tweets | $1.50 |
| 10,000 tweets for a sentiment dataset | $15 |
| A daily brand monitor returning ~200 new tweets/day | ~$9/month |

***

### Use cases

- **Brand & keyword monitoring.** Track mentions of your brand, product, or campaign hashtag in real time, and use `monitorMode` + `sinceLastRun` on a schedule to pull only what's new.
- **Sentiment & trend research.** Collect large, metric-rich datasets for topic, sentiment, and trend analysis, with `viewCount`/`bookmarkCount` giving a fuller engagement picture than likes alone.
- **Competitor tracking.** Follow competitor timelines (`fromUsers`) and high-engagement posts (`from:handle min_faves:...`) to benchmark reach and messaging.
- **Lead & influencer discovery.** Surface accounts posting about a topic, filter by engagement (`minFaves`, `minRetweets`) or verification (`filterVerified`, `filterBlue`), and mine the embedded author profiles.

***

### Honest limitations

- **Keyword search is rate-limited at the source.** The Actor rotates IPs on every request to keep results flowing, and standard jobs run real-time and full-fidelity. Under very heavy sustained volume it switches to a secondary path that trades freshness for reliability: fewer tweets per term (roughly 20–50), weighted towards older and more popular posts. Records from that path still carry full metrics.
- **Optional authenticated-session mode for guaranteed high volume.** For uninterrupted very-large jobs you can supply `authToken` (`auth_token`) + `csrfToken` (`ct0`) cookies from a logged-in x.com session. This unlocks X's own search endpoint as the primary path (with the no-login paths as fallbacks). It is entirely optional — **standard use needs no credentials**.
- **~3,200-result ceiling per query.** X's native search returns at most roughly the 3,200 most recent results for any single query. This is a **platform limit, not a limitation of this Actor**. Split large jobs by date windows (`sinceDate`/`untilDate` or `sinceTime`/`untilTime`) to page deeper.
- **Public data only.** The Actor collects publicly available tweets and the public profile of their authors. Handling that data — including any personal data inside it — is your responsibility; see *Legal* below.

***

### FAQ

**Do I need an X (Twitter) account or an API key?**
No — not for standard use. Keyword search, user timelines, and tweet lookups all run without any login or API key. An authenticated session is optional and only needed for guaranteed uninterrupted very-large jobs.

**Does it include view counts and bookmark counts?**
Yes. Every full-fidelity record includes `viewCount` and `bookmarkCount`, which many other scrapers omit.

**Can I use the full X advanced-search syntax?**
Yes. Put a complete query in `searchTerms` or `rawQuery` (e.g. `from:OpenAI min_faves:1000 lang:en`), or build it from the structured operator fields. Operators are executed server-side by X.

**How do I only get new tweets on each scheduled run?**
Enable `monitorMode` and `sinceLastRun`. The Actor remembers the newest tweet of each run in its own named key-value store, keyed per query set, so scheduled runs return only what appeared since last time — and separate monitoring jobs never overwrite each other's position. A run that finds nothing new finishes successfully with zero rows and costs you nothing.

**What proxy should I use?**
Leave the default. Proxies are configured automatically, and residential (US) is used where it matters.

**What do I actually pay for?**
Only for tweets returned. Duplicates and empty runs cost nothing.

***

### Support & feedback

**Something not working?** Open an issue on the Actor's **Issues** tab. Include the run ID and the input you used — that is usually enough to reproduce and fix it. X changes its internals often, and issues are how those changes get spotted quickly.

**Missing a field or a filter?** Issues are the right place for that too.

**If this actor saved you time, a review on the Store page would mean a lot.** Reviews are what keep a small independent actor visible next to the big ones.

***

***

### Legal

Scraping X (Twitter) is contrary to X's Terms of Service, and this Actor collects **public data only**. Tweet text and author profiles are personal data under GDPR and CCPA — make sure you have a lawful basis for collecting them and honour deletion and opt-out requests. Any session cookies you choose to supply are your own responsibility. This Actor is not affiliated with or endorsed by X Corp.

Maintained by **brilliant\_gum**.

# Actor input Schema

## `searchTerms` (type: `array`):

One or more search queries. Each item accepts the full X advanced-search syntax (e.g. 'openai lang:en min\_faves:100'). Runs without any login: operators are executed server-side by X, so results are real-time and carry every metric — views, bookmarks, likes, reposts, replies, quotes — plus the complete author profile. Supplying an authenticated session (authToken/csrfToken) is optional and only raises the ceiling on very large jobs.

## `hashtags` (type: `array`):

Hashtags to search (with or without '#'). Each becomes its own search query.

## `rawQuery` (type: `string`):

A single raw X advanced-search query, used verbatim (operators below are NOT auto-appended to it).

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

Status URLs (https://x.com/<user>/status/<id>). Looked up at full fidelity — real metrics and the complete author profile, no login needed.

## `tweetIds` (type: `array`):

Numeric tweet IDs to look up directly. Full fidelity: real metrics and the complete author profile, no login needed.

## `fromUsers` (type: `array`):

Handles (without @) whose recent tweets to pull via user-timeline (no login required).

## `toUser` (type: `string`):

Only tweets replying to this handle (compiled to 'to:'; search — needs auth).

## `mentioning` (type: `array`):

Tweets mentioning these handles (compiled to '@handle'; search — needs auth).

## `sinceDate` (type: `string`):

Only tweets on/after this date, YYYY-MM-DD (→ since:).

## `untilDate` (type: `string`):

Only tweets before this date, YYYY-MM-DD (→ until:).

## `sinceTime` (type: `integer`):

Only tweets after this unix timestamp (seconds). More reliable than since: (→ since\_time:).

## `untilTime` (type: `integer`):

Only tweets before this unix timestamp (seconds). More reliable than until: (→ until\_time:).

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

Only tweets with ID greater than this (→ since\_id:).

## `maxId` (type: `string`):

Only tweets with ID at most this (→ max\_id:).

## `lang` (type: `string`):

BCP-47 language code, e.g. 'en' (→ lang:).

## `minFaves` (type: `integer`):

Minimum like count (→ min\_faves:).

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

Minimum retweet count (→ min\_retweets:).

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

Minimum reply count (→ min\_replies:).

## `geocode` (type: `string`):

'lat,long,radius' e.g. '37.7764685,-122.4172004,10km' (→ geocode:).

## `near` (type: `string`):

Place name to search near (→ near:).

## `withinRadius` (type: `string`):

Radius for 'near', e.g. '15mi' or '10km' (→ within:).

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

X place ID (→ place:).

## `filterMedia` (type: `boolean`):

filter:media

## `filterImages` (type: `boolean`):

filter:images

## `filterVideos` (type: `boolean`):

filter:videos

## `filterLinks` (type: `boolean`):

filter:links

## `filterVerified` (type: `boolean`):

filter:verified

## `filterBlue` (type: `boolean`):

filter:blue\_verified

## `filterQuote` (type: `boolean`):

filter:quote

## `filterNativeRetweet` (type: `boolean`):

filter:nativeretweet

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

If false → -filter:replies

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

If false → -filter:nativeretweet

## `includeQuotes` (type: `boolean`):

If false → -filter:quote

## `sort` (type: `string`):

Which results to return. "Top" gives established tweets with real engagement numbers. "Latest" returns tweets posted seconds ago — they are real, but their like/repost/bookmark counts are still zero because nobody has seen them yet.

## `maxTweetsPerTerm` (type: `integer`):

Cap of tweets collected per query/term/timeline.

## `maxTotalTweets` (type: `integer`):

Global cap across all jobs in this run.

## `outputPreset` (type: `string`):

Shape of each dataset record.

## `jqFilter` (type: `string`):

Optional jq-style dot path (e.g. '.text') applied to each record for a lightweight projection. Leave empty for none.

## `monitorMode` (type: `boolean`):

Keyword-monitoring run (pairs with sinceLastRun).

## `sinceLastRun` (type: `boolean`):

With monitorMode: emit only tweets newer than the previous run (state kept in KV 'LAST\_RUN').

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

Optional. The 'auth\_token' cookie from a logged-in x.com session. Raises the ceiling on very large search jobs. Standard use needs no credentials.

## `csrfToken` (type: `string`):

Optional. The 'ct0' cookie from the same logged-in x.com session. Required together with authToken.

## `fxSearch` (type: `boolean`):

Keep enabled. The real-time keyword search used for standard jobs.

## `serpFallback` (type: `boolean`):

Keep enabled. Lets the Actor fall back to a slower search path when the primary one is rate-limited.

## `proxyConfiguration` (type: `object`):

Apify proxy. Residential is strongly recommended for X.

## `timelineFallback` (type: `boolean`):

Keep enabled. Lets a user timeline fall back to a secondary source if the main one fails; those records are flagged with metricsDegraded.

## Actor input object example

```json
{
  "searchTerms": [
    "openai"
  ],
  "hashtags": [],
  "tweetUrls": [],
  "tweetIds": [],
  "fromUsers": [],
  "mentioning": [],
  "filterMedia": false,
  "filterImages": false,
  "filterVideos": false,
  "filterLinks": false,
  "filterVerified": false,
  "filterBlue": false,
  "filterQuote": false,
  "filterNativeRetweet": false,
  "includeReplies": true,
  "includeRetweets": true,
  "includeQuotes": true,
  "sort": "Top",
  "maxTweetsPerTerm": 100,
  "maxTotalTweets": 1000,
  "outputPreset": "full",
  "monitorMode": false,
  "sinceLastRun": false,
  "fxSearch": true,
  "serpFallback": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "timelineFallback": true
}
```

# 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 = {
    "searchTerms": [
        "openai"
    ],
    "sort": "Top",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("brilliant_gum/twitter-x-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 = {
    "searchTerms": ["openai"],
    "sort": "Top",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("brilliant_gum/twitter-x-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 '{
  "searchTerms": [
    "openai"
  ],
  "sort": "Top",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call brilliant_gum/twitter-x-scraper --silent --output-dataset

```

## MCP server setup

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