# Twitter User Tweets Scraper (`twittapi/twitter-user-tweets-scraper`) Actor

Twitter User Tweets Scraper

- **URL**: https://apify.com/twittapi/twitter-user-tweets-scraper.md
- **Developed by:** [twittapi](https://apify.com/twittapi) (community)
- **Categories:** Social media
- **Stats:** 198 total users, 0 monthly users, 88.5% runs succeeded, 3 bookmarks
- **User rating**: 3.22 out of 5 stars

## Pricing

from $0.40 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 User Tweets Scraper

#### How to use?

1. Create an [Apify](https://www.apify.com?fpr=hs6s8) account

2. Open [Twitter User Tweets Scraper](https://apify.com/twittapi/twitter-user-tweets-scraper?fpr=hs6s8)

3. Add Input parameters

4. Click the `Start` button and wait for the data to be extracted
   Download your data in JSON, XML, CSV, Excel, or HTML

#### Input parameters

```json
{
  "username": "elonmusk",
  "num": 100 // Maximum results that you want to scrape
}
```

#### Output

You can download the resulting dataset in various formats such as JSON, HTML, CSV, Excel or HTML. The structure of each object looks like this:

##### Output Example

```json
{
  "id": "2102147636702634195",
  "conversation_id": "2102147636702634195",
  "desc": "timeline. ticker. trade. https://t.co/1ufRfdiYpS",
  "lang": "en",
  "view_count": 5214517,
  "bookmark_count": 2007,
  "favorite_count": 14684,
  "quote_count": 1598,
  "reply_count": 1785,
  "retweet_count": 2177,
  "medias": [
    {
      "id": "2102147574534672385",
      "url": "https://t.co/1ufRfdiYpS",
      "media_url": "https://pbs.twimg.com/amplify_video_thumb/2102147574534672385/img/8u36LZa_mB2Kh5Ic.jpg",
      "type": "video",
      "width": 1920,
      "height": 1080
    }
  ],
  "author": {
    "id": "783214",
    "encoded_id": "VXNlcjo3ODMyMTQ=",
    "screen_name": "X",
    "name": "X",
    "desc": "what's happening?!",
    "location": "everywhere",
    "website_url": "https://t.co/Xp0xJlcROt",
    "avatar_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_normal.jpg",
    "banner_url": "https://pbs.twimg.com/profile_banners/783214/1690175171",
    "created_at": "Tue Feb 20 14:35:54 +0000 2007",
    "created_at_unix": 1171982154,
    "profile_image_shape": "Square",
    "tweet_count": 15720,
    "media_tweet_count": 2492,
    "follower_count": 60733612,
    "following_count": 1,
    "favorites_count": 5970,
    "is_private": false,
    "is_verified": false,
    "is_blue_verified": true,
    "can_dm": false,
    "can_media_tag": false,
    "possibly_sensitive": false,
    "super_follow_eligible": false,
    "has_graduated_access": true,
    "urls": [
      {
        "url": "https://t.co/Xp0xJlcROt",
        "display_url": "x.com",
        "expanded_url": "https://x.com"
      }
    ],
    "affiliates_highlighted_label": {},
    "professional": {
      "category": [
        {
          "id": 714,
          "name": "Technology Company"
        }
      ],
      "id": "1858538123375874167",
      "type": "Business"
    }
  },
  "in_reply_to_tweet_id": null,
  "in_reply_to_user_id": null,
  "in_reply_to_screen_name": null,
  "is_quote_status": false,
  "quoted_status_id": null,
  "is_translatable": false,
  "is_edit_eligible": true,
  "possibly_sensitive": false,
  "possibly_sensitive_editable": true,
  "created_at_unix": 1790026027,
  "created_at": "Mon Sep 21 21:27:07 +0000 2026",
  "source": "Twitter Web App"
}
```

#### Contact

We value your feedback and are here to assist you with any questions or concerns you may have. Feel free to reach out to us throught the following email: `hi@xapi.sh`

# Actor input Schema

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

The username you want to get the data from

## `num` (type: `integer`):

Maximum number of posts that you want to scrape

## Actor input object example

```json
{
  "username": "elonmusk",
  "num": 100
}
```

# 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 = {
    "username": "elonmusk"
};

// Run the Actor and wait for it to finish
const run = await client.actor("twittapi/twitter-user-tweets-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 = { "username": "elonmusk" }

# Run the Actor and wait for it to finish
run = client.actor("twittapi/twitter-user-tweets-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 '{
  "username": "elonmusk"
}' |
apify call twittapi/twitter-user-tweets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,twittapi/twitter-user-tweets-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/UXsZhGrxSjh9wFToU/builds/3Z677J2l4pVZnjp2B/openapi.json
