# X (Twitter) Search Scraper (`akash9078/x-twitter-search-scraper`) Actor

X (Twitter) Search Scraper is a data extraction tool that collects public posts, profiles, hashtags, and engagement metrics from X (formerly Twitter) based on specific search queries. It enables users to gather real-time social media data without manually browsing the platform.

- **URL**: https://apify.com/akash9078/x-twitter-search-scraper.md
- **Developed by:** [Akash Kumar Naik](https://apify.com/akash9078) (community)
- **Categories:** AI, Lead generation, Social media
- **Stats:** 4 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$7.50 / 1,000 tweet results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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) Search Scraper — Search, Tweet & Profile Scraper

Search [Twitter/X](https://x.com) by keyword, grab a single tweet by URL, or pull a user's recent posts — all with one input field. No Twitter API key needed.

**Pricing:** $7.50 / 1,000 tweets | **Output:** JSON / CSV / Excel / HTML / XML | **Tabs:** Top · Latest · Photos · Videos

---

### TL;DR — Quick Start

```json
{ "query": "n8n automation", "max_results": 20, "product": "Latest" }
````

Or paste a tweet URL:

```json
{ "query": "https://x.com/elonmusk/status/2065485963120328945" }
```

Or a profile:

```json
{ "query": "https://x.com/elonmusk" }
```

The Actor **auto-detects** whether you're searching by keyword, fetching a single tweet, or browsing a user's timeline.

***

### Who Is This For? — Use Cases

| User | How They Use It |
|------|----------------|
| **Marketers & Brand Managers** | Monitor brand mentions, track campaign hashtags, analyze competitor activity on X |
| **Lead Generation Teams** | Find prospects mentioning relevant keywords or engaging with competitors |
| **Data Scientists & ML Engineers** | Build training datasets for NLP, sentiment analysis, and trend prediction models |
| **Researchers & Journalists** | Collect tweets by topic, date range, or author for qualitative and quantitative analysis |
| **Customer Support Teams** | Track product mentions and sentiment in real time to respond faster |
| **Investors & Analysts** | Track sentiment around stocks, crypto, or market-moving events as they unfold |
| **Content Creators** | Research trending topics, find viral content patterns, and identify influencer engagement |
| **Compliance & Legal** | Archive public tweets for regulatory compliance, evidence collection, or audit trails |

***

### Input Modes — Auto-Detected

The `query` field accepts three types of input. The Actor detects which mode to use automatically.

#### 1. Search Query (default)

Keywords, hashtags, or [advanced search operators](https://twitter.com/search-advanced).

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `query` | string | `"apify"` | Keywords, hashtags, or advanced search operators |
| `max_results` | integer | `20` | Max tweets to return (1–100) |
| `product` | select | `"Top"` | Search tab: `Top`, `Latest`, `Photos`, `Videos` |

**Examples:**

```json
{ "query": "n8n automation", "max_results": 10, "product": "Latest" }
{ "query": "ai -filter:retweets", "max_results": 50, "product": "Top" }
{ "query": "from:elonmusk", "max_results": 20 }
```

#### 2. Tweet URL

Paste a tweet link to fetch that single tweet and its replies.

```json
{ "query": "https://x.com/elonmusk/status/2065485963120328945" }
{ "query": "https://twitter.com/username/status/123456789" }
```

`max_results` and `product` are ignored in this mode.

#### 3. Profile

Paste a profile URL or `@handle` to get the user's recent tweets.

| Field | Notes |
|-------|-------|
| `query` | `https://x.com/elonmusk` or `@elonmusk` |
| `max_results` | Controls how many recent tweets to pull (1–100) |

```json
{ "query": "https://x.com/elonmusk", "max_results": 30 }
{ "query": "@n8n_io", "max_results": 10 }
```

***

#### Advanced Search Query Examples

| Goal | Query |
|------|-------|
| Tweets from a specific user | `from:elonmusk` |
| Exclude retweets | `ai -filter:retweets` |
| Date range | `climate since:2026-01-01 until:2026-03-01` |
| Language filter | `AI lang:en` |
| Minimum engagement | `crypto min_faves:100` |
| Mentions of a user | `@apify` |
| Specific hashtag | `#n8n` |
| Combine operators | `from:nasa filter:media since:2026-01-01` |

***

### Output Format

Each dataset item contains:

```json
{
  "id": "1234567890123456789",
  "url": "https://x.com/i/status/1234567890123456789",
  "text": "Hello world!",
  "author": {
    "id": "12345",
    "name": "Display Name",
    "screen_name": "username",
    "avatar": "https://pbs.twimg.com/...",
    "verified": true
  },
  "metrics": {
    "likes": 42,
    "retweets": 10,
    "replies": 5,
    "views": 2000,
    "bookmarks": 3
  },
  "media": [
    { "type": "photo", "url": "https://pbs.twimg.com/..." }
  ],
  "createdAt": "Thu Jun 11 00:36:46 +0000 2026",
  "lang": "en",
  "is_retweet": false
}
```

Download results as **JSON, CSV, HTML, Excel, or XML** from the Output tab or via the Apify API.

***

### Pricing

Pay-per-event at **$7.50 per 1,000 tweets** ($0.0075/tweet). Example costs:

| Tweets | Cost |
|--------|------|
| 100 | $0.75 |
| 1,000 | $7.50 |
| 10,000 | $75.00 |
| 100,000 | $750.00 |

Your Apify account spending limit is always respected — the Actor stops automatically when the limit is reached.

***

### Tips for Best Results

- **Search mode:** Use advanced search operators for precise queries (`from:user`, `since:`, `lang:en`, `-filter:retweets`)
- **Tweet mode:** Only the first tweet in the thread is fetched; replies appear as separate items
- **Profile mode:** Set `max_results` to what you actually need — you pay per tweet
- **Search tab:** Use **Latest** for real-time monitoring, **Top** for relevance-ranked results
- The Latest tab often returns fewer results than Top — if you need volume, use Top

***

### FAQ

#### Is scraping Twitter legal?

This Actor extracts only publicly available tweets. Respect X's Terms of Service and applicable privacy regulations (GDPR, etc.). Consult your legal team for your specific use case.

#### What happens if the search returns no results?

The Actor pushes an empty dataset and exits cleanly. Try broadening your query or switching from Latest to Top.

#### How do I get more than 100 results?

The current limit is 100 tweets per run. For larger volumes, run the Actor multiple times with different queries.

#### What if authentication fails?

Contact the developer to refresh the Twitter credentials. Authentication tokens expire when the X session is logged out.

***

# Actor input Schema

## `query` (type: `string`):

Auto-detected input. Enter a search query, tweet URL, profile URL, or @handle.

• search:   "n8n automation" or "from:elonmusk"
• tweet:    https://x.com/user/status/123456789
• profile:  https://x.com/elonmusk  or  @elonmusk

## `max_results` (type: `integer`):

Maximum number of tweets to return (for search and profile modes only)

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

Which search results tab to use (search mode only; ignored for tweet/profile URLs)

## Actor input object example

```json
{
  "query": "apify OR web scraping -filter:retweets",
  "max_results": 20,
  "product": "Top"
}
```

# Actor output Schema

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

Collection of scraped tweets from the search query

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("akash9078/x-twitter-search-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("akash9078/x-twitter-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call akash9078/x-twitter-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=akash9078/x-twitter-search-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X (Twitter) Search Scraper",
        "description": "X (Twitter) Search Scraper is a data extraction tool that collects public posts, profiles, hashtags, and engagement metrics from X (formerly Twitter) based on specific search queries. It enables users to gather real-time social media data without manually browsing the platform.",
        "version": "0.2",
        "x-build-id": "zweYkup3H0kV7N6sr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/akash9078~x-twitter-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-akash9078-x-twitter-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/akash9078~x-twitter-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-akash9078-x-twitter-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/akash9078~x-twitter-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-akash9078-x-twitter-search-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "query"
                ],
                "properties": {
                    "query": {
                        "title": "Query / URL / @handle",
                        "type": "string",
                        "description": "Auto-detected input. Enter a search query, tweet URL, profile URL, or @handle.\n\n  • search:   \"n8n automation\" or \"from:elonmusk\"\n  • tweet:    https://x.com/user/status/123456789\n  • profile:  https://x.com/elonmusk  or  @elonmusk",
                        "default": "apify"
                    },
                    "max_results": {
                        "title": "Maximum Results",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of tweets to return (for search and profile modes only)",
                        "default": 20
                    },
                    "product": {
                        "title": "Search Tab",
                        "enum": [
                            "Top",
                            "Latest",
                            "Photos",
                            "Videos"
                        ],
                        "type": "string",
                        "description": "Which search results tab to use (search mode only; ignored for tweet/profile URLs)",
                        "default": "Top"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
