# X (twitter) Search Scraper (`datamagnet/x-twitter-search-actor`) Actor

Search for posts or content matching a keyword and return the results in a simple, readable format.

- **URL**: https://apify.com/datamagnet/x-twitter-search-actor.md
- **Developed by:** [Datamagnet](https://apify.com/datamagnet) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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/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

## Content Search Scraper

Content Search Scraper helps you find posts and content by keyword and turn them into a clean, easy-to-read list. It is built for marketers, researchers, analysts, and creators who need fast access to social content without digging through endless search results. Use it to search by keyword, narrow results by type such as Top or Latest, and collect the most relevant details in one place. It automatically gathers additional pages when needed so you can get more complete results with less effort.

### Key Features
- **Extract** matching posts and content from a keyword search in a simple, readable format.
- **Collect** the most relevant details for each result, including title-like text, preview text, source, and identifiers.
- **Filter** results by search type to focus on Top, Latest, Media, People, or Lists.
- **Expand** your search automatically across multiple pages until your requested result limit is reached.
- **Save** time by getting cleaned results that are easier to review than raw search pages.
- **Support** research, monitoring, and content discovery workflows with one flexible search tool.
- **Deliver** results in a format that is easy to export, share, and analyze.

### Use Cases

#### Social Listening
Brand and communications teams use this actor to search for mentions of a product, company, or topic and review the returned `text`, `screen_name`, `created_at`, and engagement fields like `favorites`, `replies`, and `retweets`. This makes it easier to spot what people are saying, identify high-interest posts, and understand the tone of the conversation.

#### Market Research
Researchers can search for a keyword related to a trend, competitor, or industry topic and quickly scan the `text`, `lang`, `views`, and `user_info` fields. The results help teams understand what content is gaining attention, who is posting it, and how audiences are reacting.

#### Content Discovery
Creators and editors use the actor to find posts worth referencing, resharing, or turning into new content. By reviewing the `text`, `media`, `source`, and `created_at` fields, they can identify timely posts, visual content, and recurring themes that may inspire future campaigns.

#### Competitor Tracking
Marketing teams can search for competitor names, product launches, or campaign phrases and compare the returned posts by `favorites`, `quotes`, `replies`, and `views`. This helps them see which messages are resonating and which accounts are driving the most attention.

#### Audience Analysis
Community managers and analysts can review the `user_info` fields such as `followers_count`, `verified`, `location`, and `description` to understand who is posting about a topic. Combined with the post text and engagement metrics, this gives a clearer picture of the audience behind the conversation.

#### Media and Trend Monitoring
Teams focused on visual or fast-moving topics can use the `search_type` filter to narrow results and review posts that include `media` details. This is useful for tracking trending images, videos, and posts that are spreading quickly across the platform.

### Input

| Field | Type | Required | Description | Example |
|---|---|---:|---|---|
| query | string | Yes | The word or phrase you want to search for. | superman |
| max_results | integer | No | The maximum number of results you want returned. | 10 |
| search_type | string | No | Choose how the search should be focused, such as Top, Latest, Media, People, or Lists. | Latest |

### Output

| Field | Type | Description |
|---|---|---|
| type | string | The kind of result returned, so you can quickly understand what you are looking at. |
| tweet_id | string | A unique identifier for the post, useful for tracking or referencing the result later. |
| screen_name | string | The account name that posted the content. |
| bookmarks | integer | How many times the post was bookmarked, which can indicate interest or usefulness. |
| favorites | integer | How many likes the post received. |
| created_at | string | The date and time the post was published. |
| text | string | The main content of the post, shown in a cleaned and readable form. |
| lang | string | The language of the post. |
| display_text_range | array | The visible text range for the post content. |
| source | string | Where the post was published from, such as a web app or mobile app. |
| quotes | integer | How many times the post was quoted. |
| replies | integer | How many replies the post received. |
| conversation_id | string | The conversation thread identifier for the post. |
| retweets | integer | How many times the post was reshared. |
| views | string | The number of views the post received. |
| entities | object | Extra content details such as hashtags, links, mentions, timestamps, or media references. |
| user_info | object | Profile details about the account that posted the content. |
| media | object | Media attached to the post, such as images or videos, when available. |

### Sample Output
```json
{
  "type": "tweet",
  "tweet_id": "2071437744832962670",
  "screen_name": "xsphyre",
  "bookmarks": 63,
  "favorites": 649,
  "created_at": "Mon Jun 29 03:36:58 +0000 2026",
  "text": "Man of Steel sold over 74 million tickets worldwide, hitting a box office total of $670M. This puts the revenue per ticket at $9.05...",
  "lang": "en",
  "display_text_range": [0, 279],
  "source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
  "quotes": 8,
  "replies": 55,
  "conversation_id": "2071437744832962670",
  "retweets": 96,
  "views": "35659",
  "entities": {
    "hashtags": [],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "user_info": {
    "screen_name": "xsphyre",
    "name": "𝓧𝓼𝓹𝔂𝓻𝓮",
    "created_at": "Fri Oct 07 20:16:22 +0000 2022",
    "description": "",
    "rest_id": "1578479256098988034",
    "followers_count": 472,
    "favourites_count": 27544,
    "avatar": "https://pbs.twimg.com/profile_images/2050248880047177728/Ft6qpKwA_normal.jpg",
    "url": null,
    "cover_image": "https://pbs.twimg.com/profile_banners/1578479256098988034/1777650865",
    "verified_type": null,
    "verified": true,
    "friends_count": 261,
    "location": "🤍🖤"
  },
  "media": {
    "video": [
      {
        "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/HL85hQpbwAENRQi.jpg",
        "variants": [
          {
            "bitrate": 0,
            "content_type": "video/mp4",
            "url": "https://video.twimg.com/tweet_video/HL85hQpbwAENRQi.mp4"
          }
        ],
        "aspect_ratio": [199, 103],
        "duration": null,
        "original_info": {
          "focus_rects": [],
          "height": 412,
          "width": 796
        },
        "id": "2071437597180936193"
      }
    ]
  }
}
````

### How It Works

1. You enter the keyword or phrase you want to search for.
2. You optionally choose a search type to focus the results.
3. The actor searches for matching posts and content and gathers the most relevant details.
4. If there are more results than fit on one page, it continues automatically until it reaches your requested limit.
5. You review the cleaned results and use them for research, reporting, or content planning.

### Getting Started

Getting started is simple and does not require coding knowledge. Click **Try for free**, enter your search keyword, optionally choose a search type, and set the maximum number of results you want. Then click **Run** and let the actor do the work for you. When it finishes, your results are ready to view and download in JSON, CSV, or Excel.

### Frequently Asked Questions

#### Do I need technical skills?

No. This actor is designed for business users, marketers, researchers, and creators who want results without dealing with complicated setup. You only need to enter a search term, choose optional filters if you want them, and run the actor.

#### How fast does it run?

Speed depends on how broad your search is and how many results you request. Smaller searches usually finish quickly, while larger searches may take a bit longer because the actor automatically gathers more pages when needed.

#### What format is the output?

Your results are available in easy-to-use formats such as JSON, CSV, or Excel. This makes it simple to review the data, share it with teammates, or import it into your own reporting workflow.

#### Is this legal to use?

The actor is intended for lawful research, monitoring, and content discovery use cases. You should always make sure your use follows applicable laws, platform rules, and your organization’s policies.

#### Can I schedule it to run automatically?

Yes, you can set it up to run on a schedule if you want regular updates. This is useful for ongoing monitoring, trend tracking, and keeping an eye on new posts that match your keyword.

# Actor input Schema

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

The keyword or phrase to search for.

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

Maximum number of results to return.

## `search_type` (type: `string`):

Choose which kind of results to search for.

## Actor input object example

```json
{
  "query": "superman",
  "max_results": 10
}
```

# 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 = {
    "query": "superman",
    "max_results": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamagnet/x-twitter-search-actor").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 = {
    "query": "superman",
    "max_results": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("datamagnet/x-twitter-search-actor").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 '{
  "query": "superman",
  "max_results": 10
}' |
apify call datamagnet/x-twitter-search-actor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X (twitter) Search Scraper",
        "description": "Search for posts or content matching a keyword and return the results in a simple, readable format.",
        "version": "0.0",
        "x-build-id": "VlcEgKRt7zsEA548d"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamagnet~x-twitter-search-actor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamagnet-x-twitter-search-actor",
                "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/datamagnet~x-twitter-search-actor/runs": {
            "post": {
                "operationId": "runs-sync-datamagnet-x-twitter-search-actor",
                "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/datamagnet~x-twitter-search-actor/run-sync": {
            "post": {
                "operationId": "run-sync-datamagnet-x-twitter-search-actor",
                "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": "Search query",
                        "type": "string",
                        "description": "The keyword or phrase to search for."
                    },
                    "max_results": {
                        "title": "Max results",
                        "type": "integer",
                        "description": "Maximum number of results to return."
                    },
                    "search_type": {
                        "title": "Search type",
                        "enum": [
                            "Top",
                            "Latest",
                            "Media",
                            "People",
                            "Lists"
                        ],
                        "type": "string",
                        "description": "Choose which kind of results to search for."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
