# Twitter (X.com) Tweets & Profiles Scraper (`web.harvester/twitter-scraper`) Actor

Extract tweets and full profile data from any Twitter (X.com) account with our powerful scraper. Search profiles, scrape tweets with replies, or extract data via URL or username. Download in JSON, CSV, Excel, XML, or HTML—ideal for social media monitoring, content analysis, and competitive research.

- **URL**: https://apify.com/web.harvester/twitter-scraper.md
- **Developed by:** [Web Harvester](https://apify.com/web.harvester) (community)
- **Categories:** News, Social media, Lead generation
- **Stats:** 7,856 total users, 34 monthly users, 99.4% runs succeeded, 123 bookmarks
- **User rating**: 4.56 out of 5 stars

## Pricing

$30.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

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

## Twitter Profile & Tweets Scraper: Search and Extract X (Twitter) Profiles & Tweets

### 🔍 Advanced X (Twitter) Profile & Tweet Extraction Tool

Effortlessly extract tweets and complete profile information from any X (Twitter) account with our powerful scraping tool. Search for profiles, extract their tweets with replies, or directly scrape specific accounts by providing a URL or username. Download everything in multiple formats including JSON, CSV, Excel, XML, and HTML Table - perfect for social media monitoring, content analysis, competitive research, and audience insights.

### ✅ Key Features

- **Complete Profile Data**: Extract user info, bio, location, website, join date, and metrics
- **Search Users Profiles**: Find and extract user data and tweets by searching for profiles with keywords, names, etc.
- **Comprehensive Tweet Collection**: Get tweet text, timestamps, media, and engagement metrics
- **Reply Threading**: Option to include replies and conversations with tweets
- **Media Support**: Automatically extracts images, videos, and other media from tweets
- **Engagement Metrics**: Captures likes, replies, retweets, quotes, and view counts
- **Flexible Input Methods**: Search by username/handle or direct profile URL
- **Multiple Export Formats**: Download as JSON, CSV, Excel, XML, RSS, or HTML Table

### 📊 Twitter Profile & Tweets Output Data Fields

Our scraper captures comprehensive profile information and tweet data. The output is stored in your dataset and available for download in multiple formats after completion.

### 🔧 Input Configuration Example

Here's an input example in JSON:

```json
{
    "startUrls": ["https://x.com/elonmusk"],
    "handles": ["Apify", "OpenAI"],
    "tweetsDesired": 200,
    "withReplies": true,
    "includeUserInfo": true
}
```

You can configure:

- `startUrls`: Direct Twitter profile URLs
- `handles`: Twitter handles (with or without @ symbol)
- `tweetsDesired`: Number of tweets to collect per profile
- `withReplies`: Whether to include tweet replies
- `includeUserInfo`: Whether to include detailed user information

### 📋 Output Example

```json
{
    "id": "1883455266861232295",
    "url": "https://x.com/Alice_Weidel/status/1883455266861232295",
    "verified": true,
    "username": "@Alice_Weidel",
    "fullname": "Alice Weidel",
    "timestamp": "2025-01-26T07:01:00.000Z",
    "text": "Elon Musk's great speech at our party convention! Make America & Germany great again! 🇺🇸🇩🇪",
    "links": [],
    "isPinned": false,
    "isQuote": false,
    "isRetweet": false,
    "isReply": false,
    "likes": 38760,
    "replies": 2077,
    "retweets": 5675,
    "quotes": 382,
    "user": {
        "avatar": "https://pbs.twimg.com/profile_images/1865369631885492224/sjrFObu6_normal.jpg",
        "username": "Alice_Weidel",
        "userFullName": "Alice Weidel",
        "description": "AfD Kanzlerkandidatin 2025 |  Fraktionsvorsitzende der @AfDimBundestag | AfD-Bundessprecherin",
        "location": "Berlin, Deutschland",
        "website": "https://www.facebook.com/aliceweidel/?locale2=de_DE",
        "joinDate": "2017-02-19T19:29:51.000Z",
        "verified": true,
        "totalLikes": 720,
        "totalTweets": 4478,
        "totalFollowing": 578,
        "totalFollowers": 931337,
        "url": "https://x.comhttps//t.co/a6AEdJ1A33",
        "userId": "833398209053605888",
        "totalMediaCount": 2150
    },
    "media": [
        {
            "type": "video",
            "url": "https://video.twimg.com/amplify_video/1883454571596455936/vid/avc1/1280x720/zTKTZQZRvXVMFMdG.mp4?tag=14"
        }
    ],
    "tweetUserId": "833398209053605888"
}
```

### 🚀 Why Choose Our Twitter Profile & Tweets Scraper

- **No API Limitations**: Access Twitter data without API restrictions
- **No Authentication Required**: Use without Twitter credentials
- **Historical Data Access**: Get tweets from the past, not just recent ones
- **Complete Content**: Extract full conversations and threads
- **Real-time Data**: Always get the most current profile and tweet information
- **Cloud-based Solution**: No need to install software locally
- **Regular Updates**: Tool is maintained to adapt to Twitter's changes

### 🔍 Complete Twitter Scraping Toolkit

Enhance your Twitter data collection capabilities with our complete suite of specialized X (Twitter) scrapers:

<table>
    <tr>
        <td>🐦 <a href="https://apify.com/web.harvester/twitter-scraper" title="Scrape tweets and profiles from Twitter">Twitter Tweets and Profiles Scraper</a>
            <p>Extract tweets, threads, and complete profiles from any account. Perfect for content analysis, sentiment analysis, and tracking social media engagement metrics.</p>
        </td>
        <td>🔍 <a href="https://apify.com/web.harvester/easy-twitter-search-scraper" title="Easily scrape search results from Twitter">Twitter Search Results Scraper</a>
            <p>Harvest tweets from Twitter search results with advanced filtering options. Ideal for market research, competitor analysis, and trend monitoring.</p>
        </td>
    </tr>
    <tr>
        <td>👥 <a href="https://apify.com/web.harvester/twitter-users-scraper" title="Scrape user data from Twitter">Twitter Users Scraper</a>
            <p>Extract complete user profiles with detailed metrics and biographical information. Perfect for influencer research, audience analysis, and lead generation.</p>
        </td>
        <td>🆔 <a href="https://apify.com/web.harvester/twitter-users-ids-scraper" title="Scrape user IDs from Twitter">Twitter Users IDs Scraper</a>
            <p>Quickly extract numerical Twitter IDs from any profile. Essential for API integration, user tracking, and database management.</p>
        </td>
    </tr>
</table>

# Actor input Schema

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

No description

## `handles` (type: `array`):

No description

## `userQueries` (type: `array`):

A list of search queries for Twitter users. The scraper will scrape the tweets of the users returned by the search query.

## `tweetsDesired` (type: `integer`):

By setting this to 0, it will scrape only the profile info (for profiles only)

## `repliesDepth` (type: `integer`):

How many levels of replies should be scraped. 0 means no replies, 1 means the tweet and its replies, 2 means the tweet, its replies and the replies of the replies, etc.

## `profilesDesired` (type: `integer`):

This value lets you set the maximum number of profiles to retrieve per search query (for "Users search queries")

## `withReplies` (type: `boolean`):

Scrape tweets and replies to tweets (enabling this increases the number of tweets per profile to ~3200), e.g. https://x.com/elonmusk/with\_replies

## `includeUserInfo` (type: `boolean`):

This will add the profile user info to every tweet result. This is useful if you want to scrape tweets from multiple profiles and want to know which profile each tweet belongs to.

## `storeUserIfNoTweets` (type: `boolean`):

If no tweets are found, store the user data anyway

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

This lets you specify the oldest date of tweets to extract, format <code>YYYY-MM-DD</code>. You can also use relative dates such as '1 month' or '2 days' instead of absolute dates such as '2020-02-29'.

## `proxyConfig` (type: `object`):

No description

## Actor input object example

```json
{
  "startUrls": [],
  "handles": [
    "elonmusk"
  ],
  "userQueries": [],
  "tweetsDesired": 100,
  "profilesDesired": 10,
  "withReplies": true,
  "includeUserInfo": true,
  "storeUserIfNoTweets": false,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "handles": [
        "elonmusk"
    ],
    "userQueries": [],
    "tweetsDesired": 100,
    "profilesDesired": 10,
    "proxyConfig": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("web.harvester/twitter-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 = {
    "handles": ["elonmusk"],
    "userQueries": [],
    "tweetsDesired": 100,
    "profilesDesired": 10,
    "proxyConfig": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("web.harvester/twitter-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 '{
  "handles": [
    "elonmusk"
  ],
  "userQueries": [],
  "tweetsDesired": 100,
  "profilesDesired": 10,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call web.harvester/twitter-scraper --silent --output-dataset

```

## MCP server setup

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