# Twitter (X) Scraper (`digiscraper/twitter-scrapper`) Actor

Scrape X/Twitter profiles, search results, trends, replies and post details. Profile and post details work without login; search, trends and replies use your own X cookies.

- **URL**: https://apify.com/digiscraper/twitter-scrapper.md
- **Developed by:** [digiscraper](https://apify.com/digiscraper) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 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.

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

## Twitter (X) Scraper

Scrape X / Twitter **profiles, search results, trends, replies, and post details** — no official API key needed. One flat price: **$0.40 per 1,000 results**, no tiers, no discounts.

Built for marketers, researchers, journalists, and founders who track what people say on X: monitor a brand or competitor, follow a topic, collect replies to a post, or pull full post details for analysis.

### What you can scrape

Fill any combination of inputs — every filled mode runs in the same run, and every result lands in one dataset.

| Input | What you get |
|---|---|
| `username` | Full profile (followers, bio, avatar) + latest tweets with engagement stats (likes, retweets, views) |
| `query` + `search_type` (Top / Latest / Media) | Search results for any X advanced-search query |
| `country` (name or WOEID) | Trending topics for that place |
| `post_id` | Replies to that post |
| `post_ids` | Full details for each post |

`max_posts` limits the posts returned per mode (default 100, up to 10,000). Most modes work without any login — just provide a username or post ID and go.

### Input example

Scrape a profile's latest posts — no login needed:

```json
{
  "username": "nasa",
  "max_posts": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

Search with an advanced query:

```json
{
  "query": "from:nasa since:2026-11-01 include:nativeretweets -filter:replies",
  "search_type": "Latest",
  "max_posts": 50,
  "auth_token": "YOUR_AUTH_TOKEN_COOKIE",
  "ct0": "YOUR_CT0_COOKIE"
}
```

### Output Format

Every item has a `type`: `tweet`, `user`, `trend`, or `error`. Tweets carry the full post and author data:

```json
{
  "type": "tweet",
  "tweet_id": "2118723980961976469",
  "screen_name": "Prysmian_",
  "created_at": "Fri Nov 06 15:15:00 +0000 2026",
  "text": "Ever heard of a cable jointer? ...",
  "lang": "en",
  "favorites": 0,
  "retweets": 0,
  "replies": 0,
  "quotes": 0,
  "bookmarks": 0,
  "views": "79",
  "url": "https://x.com/Prysmian_/status/2118723980961976469",
  "conversation_id": "2118723980961976469",
  "entities": { "hashtags": [], "media": [], "urls": [], "user_mentions": [] },
  "user_info": {
    "screen_name": "Prysmian_",
    "name": "Prysmian",
    "followers_count": 6515
  },
  "media": { "video": [], "photo": [] }
}
```

Retweets include a nested `retweeted_tweet`, quote posts a nested `quoted`. Profile runs also return a `user` record with follower counts, bio, and account dates.

Export results as JSON, CSV, or Excel, or use them via the Apify API.

### Pricing

One simple price, the same for every plan — no tiers, no discounts:

| Event | Price |
|---|---|
| Result | **$0.40 per 1,000 results** |
| Actor start | $0.00005 per run |

You pay only for results delivered. Platform usage is billed at standard Apify rates; use of Apify Proxy is charged separately at Apify's proxy rates.

### Login cookies (optional)

For advanced search, trends, and replies, add your X cookies (`auth_token` + `ct0`) from your browser (DevTools → Application → Cookies). They are secret input fields on Apify — never stored in code, never logged.

We recommend the **RESIDENTIAL** Apify Proxy group for best results.

### FAQ

**Do I need an X API key?** No. Everything here works without one.

**Can I run this on a schedule?** Yes — set a Schedule in Apify Console (e.g. hourly for a brand monitor) and each run appends to your dataset.

**Which proxy should I use?** Apify Proxy with the RESIDENTIAL group for best performance.

# Actor input Schema

## `username` (type: `string`):

Scrape a profile and its latest posts. e.g. 'shoptemu', '@shoptemu' or https://x.com/shoptemu. Works without login (tweets are more reliable with cookies).

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

Any X advanced-search query, e.g. from:shoptemu since:2026-10-27 include:nativeretweets -filter:replies. Queries with from:<username> also work without login (recent posts only); any other query needs auth_token + ct0.

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

Which search tab to scrape.

## `country` (type: `string`):

Country name (e.g. Pakistan, United States, Worldwide) or a WOEID number. Needs auth_token + ct0.

## `post_id` (type: `string`):

Post ID or URL to scrape replies for. Needs auth_token + ct0.

## `post_ids` (type: `array`):

Post IDs or URLs to get full details for. Works without login.

## `max_posts` (type: `integer`):

Maximum posts returned per mode (profile / search / replies).

## `auth_token` (type: `string`):

Needed for search, trends and replies. Copy the 'auth_token' cookie from x.com (DevTools > Application > Cookies). Use a secondary account.

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

The 'ct0' cookie from the same browser session.

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

Recommended. RESIDENTIAL gives the best results.

## Actor input object example

```json
{
  "search_type": "Latest",
  "max_posts": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("digiscraper/twitter-scrapper").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 = { "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    } }

# Run the Actor and wait for it to finish
run = client.actor("digiscraper/twitter-scrapper").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 '{
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call digiscraper/twitter-scrapper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,digiscraper/twitter-scrapper"
        }
    }
}
```

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/MdOLakbCsXWnigrNH/builds/tDGqemWZNdRQrLe3m/openapi.json
