# Twitter (X) Reply Scraper (`louisdeconinck/twitter-reply-scraper`) Actor

Extract detailed information about tweets and their replies from Twitter/ X.com. This scraper collects data on tweet & comment details, user information, and reply content, providing insights for social media analysis, sentiment tracking & trend monitoring. No authentication or cookies needed.

- **URL**: https://apify.com/louisdeconinck/twitter-reply-scraper.md
- **Developed by:** [Louis Deconinck](https://apify.com/louisdeconinck) (community)
- **Categories:** Social media, Lead generation, News
- **Features:** Limited permissions
- **Stats:** 522 total users, 5 monthly users, 0.0% runs succeeded, 6 bookmarks
- **User rating**: 2.86 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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) Reply Scraper

Twitter (X) Reply Scraper is an Apify actor that allows you to extract detailed information about tweets and their replies from [Twitter.com / X.com](https://www.x.com). This scraper can collect data on tweet & comment details, user information, and reply content, providing valuable insights for social media analysis, sentiment tracking, or trend monitoring.

### Why use Twitter (X) Reply Scraper?

- **Comprehensive Data Collection**: Gather extensive information about tweets, including text, engagement metrics, and timestamps.
- **Reply Insights**: Extract detailed information about replies & comments, including user data and engagement metrics.
- **Flexible Scraping Options**: Choose to focus on specific tweets or users based on your research needs.
- **No Authentication Required**: No need for cookies or authentication, removing the risk of bans and making it easier to use.

### How to use Twitter (X) Reply Scraper

1. **Set up your Input**:
   - Provide start URLs from X.com (e.g., specific search URLs).
   - Set the maximum number of tweets to scrape.
   - Set the maximum number of replies per tweet to scrape.

2. **Run the Actor**:
   Start the actor and let it crawl the specified X pages.

3. **Retrieve Results**:
   Once the run is complete, download the scraped data in your preferred format (JSON, CSV, or Excel).

### Input Configuration

- **startUrls**: Provide a list of URLs from X.com (e.g., specific tweet URLs).
- **maxSearchResults**: Set the maximum number of search results to scrape.
- **maxReplies**: Set the maximum number of replies per tweet to scrape. If you're only interested in the tweet, set this to 0, it will greatly reduce your usage costs and speed up the process a lot.

#### Example Input

```json
{
	"startUrls": [
		{
			"url": "https://x.com/search?q=%23journorequest+min_replies%3A10&src=typed_query&f=live"
		},
		{
			"url": "https://x.com/search?q=%23durftevragen+min_replies%3A10&src=typed_query&f=live"
		}
	],
	"maxSearchResults": 30,
	"maxReplies": 10
}
```

#### Obtaining Start URLs

You can copy any X.com search URL and use it as a start URL. You can select the Latest tab to get the latest tweets or the Top tab to get the most popular tweets.

There is also an advanced search option available at https://x.com/search-advanced where you can use various parameters to refine your search results more precisely.

You can set these parameters in the advanced search page:

- Words:
  - Use keywords or phrases to search for specific content.
  - Example: "breaking news" will find tweets containing the exact phrase "breaking news".
  - Use "OR" to search for tweets containing either of two terms (e.g., "cats OR dogs").
  - Use "-" before a word to exclude tweets containing that word (e.g., "-cats" excludes tweets with "cats").
  - Use "#" to search for specific hashtags (e.g., "#ThrowbackThursday").

- Accounts:
  - Use "from:" to find tweets from a specific account (e.g., "from:@X").
  - Use "to:" to find replies to a specific account (e.g., "to:@X").
  - Use "@" to find tweets mentioning specific accounts (e.g., "@SFBART OR @Caltrain").

- Filters:
  - Select "Replies" to include or exclude reply tweets.
  - Choose "Links" to include or focus on tweets with links.

- Engagement:
  - Use "min_replies:", "min_faves:", or "min_retweets:" followed by a number to set minimum engagement thresholds.

- Date Range:
  - Specify a date range to narrow down the search period.

- Language:
  - Select a specific language to filter tweets.

- Location:
  - Specify a location to find geo-tagged tweets from that area.

### Output Data

The actor will output the following data for each tweet and its replies:

- **tweetLink**: The URL of the tweet.
- **avatar**: The URL of the user's avatar.
- **fullname**: The full name of the user who posted the tweet.
- **handle**: The handle of the user who posted the tweet.
- **verified**: Whether the user is verified.
- **tweetDate**: The timestamp of the tweet.
- **tweetContent**: The text of the tweet.
- **commentCount**: The number of comments the tweet has received.
- **retweetCount**: The number of retweets the tweet has received.
- **quoteCount**: The number of quotes the tweet has received.
- **likeCount**: The number of likes the tweet has received.
- **repliesData**: An array of replies to the tweet, each containing the same fields as the tweet.

#### Example Output

```json
{
	"tweetLink": "https://x.com/meehikabarua/status/1867564631180632295",
	"avatar": "https://pbs.twimg.com/profile_images/1690785189792735232/BmUFicth_bigger.jpg",
	"fullname": "Meehika Barua",
	"handle": "@meehikabarua",
	"verified": null,
	"tweetDate": "2024-12-13T13:38:00.000Z",
	"tweetContent": "Looking for menswear experts to comment on what to wear to job interview for a Men's Journal piece. Deadline 16th Dec. Email in bio.\n#journorequest #prrequest",
	"commentCount": 11,
	"retweetCount": 4,
	"quoteCount": 0,
	"likeCount": 11,
	"repliesData": [
		{
			"tweetLink": "https://x.com/editorielle/status/1867567715252408465",
			"avatar": "https://pbs.twimg.com/profile_images/1730590378942681088/MbS2v-ce_bigger.jpg",
			"fullname": "EDITORIELLE",
			"handle": "@editorielle",
			"verified": "verified",
			"tweetDate": "2024-12-13T13:50:00.000Z",
			"tweetContent": "We've shared this with our Fashion network for you Meehika! Thanks, Bethany x",
			"commentCount": 1,
			"retweetCount": 0,
			"quoteCount": 0,
			"likeCount": 1
		},
		{
			"tweetLink": "https://x.com/MediaMatchMaker/status/1867585988102697438",
			"avatar": "https://pbs.twimg.com/profile_images/1148575226432802818/nLiLszhz_bigger.png",
			"fullname": "MediaMatchMaker",
			"handle": "@MediaMatchMaker",
			"verified": "verified",
			"tweetDate": "2024-12-13T15:02:00.000Z",
			"tweetContent": "Hi Meehika, we have shared this for you and let us know if we can help with any future journo requests. - Media Matchmaker Team",
			"commentCount": 1,
			"retweetCount": 0,
			"quoteCount": 0,
			"likeCount": 0
		},
		{
			"tweetLink": "https://x.com/KintijaPR/status/1867602139679498305",
			"avatar": "https://pbs.twimg.com/profile_images/1854884381308895232/uPeanSn1_bigger.jpg",
			"fullname": "kintija/ kiki",
			"handle": "@KintijaPR",
			"verified": null,
			"tweetDate": "2024-12-13T16:07:00.000Z",
			"tweetContent": "Hey Meehika, have dropped you an email in regard to this! 😊",
			"commentCount": 1,
			"retweetCount": 0,
			"quoteCount": 0,
			"likeCount": 1
		},
		{
			"tweetLink": "https://x.com/makesyoucakes/status/1867565936443580435",
			"avatar": "https://pbs.twimg.com/profile_images/1767833219280580608/MR3fO5Yd_bigger.jpg",
			"fullname": "Makepeace Sitlhou",
			"handle": "@makesyoucakes",
			"verified": null,
			"tweetDate": "2024-12-13T13:43:00.000Z",
			"tweetContent": "Only guy worth talking to @dieworkwear",
			"commentCount": 1,
			"retweetCount": 0,
			"quoteCount": 0,
			"likeCount": 2
		}
	]
}
```

# Actor input Schema

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

URLs to scrape

## `maxSearchResults` (type: `integer`):

Maximum number of search results to scrape

## `maxReplies` (type: `integer`):

Maximum number of replies to scrape per tweet

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://x.com/search?q=%23journorequest+min_replies%3A10&src=typed_query&f=live"
    }
  ],
  "maxSearchResults": 5,
  "maxReplies": 5
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://x.com/search?q=%23journorequest+min_replies%3A10&src=typed_query&f=live"
        }
    ],
    "maxSearchResults": 5,
    "maxReplies": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("louisdeconinck/twitter-reply-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 = {
    "startUrls": [{ "url": "https://x.com/search?q=%23journorequest+min_replies%3A10&src=typed_query&f=live" }],
    "maxSearchResults": 5,
    "maxReplies": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("louisdeconinck/twitter-reply-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 '{
  "startUrls": [
    {
      "url": "https://x.com/search?q=%23journorequest+min_replies%3A10&src=typed_query&f=live"
    }
  ],
  "maxSearchResults": 5,
  "maxReplies": 5
}' |
apify call louisdeconinck/twitter-reply-scraper --silent --output-dataset

```

## MCP server setup

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