# Twitter comments scraper (`curious_coder/twitter-replies-scraper`) Actor

Scrape twitter comments and users from given tweet url. Useful to DM to people who might be interested in your product or service.

- **URL**: https://apify.com/curious_coder/twitter-replies-scraper.md
- **Developed by:** [Curious Coder](https://apify.com/curious_coder) (community)
- **Categories:** Automation, Social media
- **Features:** Full permissions
- **Stats:** 867 total users, 2 monthly users, 99.6% runs succeeded, 19 bookmarks
- **User rating**: 4.84 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

### How it works

You need to pass twitter cookies to this actor to use the existing session to  perform scraping.

You can customise and randomise the delay between scraping pages.

### Getting Started

- Install [Cookie-Editor](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) chrome extension
- Login to your twitter account
- Click on the extension and export the twitter cookies
- Paste the cookies into this actor's `cookie` input field

If you are interested in scraping twitter data, you must also check out these scrapers:

- [Twitter followers scraper](https://apify.com/curious_coder/twitter-scraper) lets you extract all followers (including hidden) of any twitter account
- [Twitter likes scraper](https://apify.com/curious_coder/twitter-likes-scraper) lets you collect all the likes or favorites of given tweets along with profile details of likers

Check out other similar scrapers:

- [Youtube comment scraper](https://apify.com/supreme_coder/youtube-comment-scraper/)
- [Linkedin comment scraper](https://apify.com/curious_coder/linkedin-comment-scraper/)
- [Facebook comment scraper](https://apify.com/curious_coder/facebook-comment-scraper)

Here is the sample output of this actor:

```json
{
	"bookmark_count": 0,
	"bookmarked": false,
	"created_at": "Fri Jul 14 12:15:36 +0000 2023",
	"conversation_id_str": "1679808034837774336",
	"display_text_range": [
		0,
		105
	],
	"entities": {
		"user_mentions": [],
		"urls": [
			{
				"display_url": "the-viral-supplement.ck.page/signup",
				"expanded_url": "https://the-viral-supplement.ck.page/signup",
				"url": "https://t.co/EHVtpm5BS3",
				"indices": [
					82,
					105
				]
			}
		],
		"hashtags": [],
		"symbols": []
	},
	"favorite_count": 2,
	"favorited": false,
	"full_text": "Did someone say free viral Tweet breakdowns in your inbox every week?\n\nJoin here👇\nhttps://t.co/EHVtpm5BS3",
	"in_reply_to_screen_name": "_danreynolds_",
	"in_reply_to_status_id_str": "1679808034837774336",
	"in_reply_to_user_id_str": "1158101960",
	"is_quote_status": false,
	"lang": "en",
	"possibly_sensitive": false,
	"possibly_sensitive_editable": true,
	"quote_count": 0,
	"reply_count": 2,
	"retweet_count": 0,
	"retweeted": false,
	"user_id_str": "1158101960",
	"id_str": "1679826980378738688",
	"source_name": "Hypefury",
	"source_url": "https://hypefury.com",
	"views": "220",
	"user": {
		"__typename": "User",
		"id": "VXNlcjoxMTU4MTAxOTYw",
		"rest_id": "1158101960",
		"affiliates_highlighted_label": {},
		"has_graduated_access": true,
		"is_blue_verified": true,
		"profile_image_shape": "Circle",
		"legacy": {
			"can_dm": true,
			"can_media_tag": true,
			"created_at": "Thu Feb 07 19:45:54 +0000 2013",
			"default_profile": true,
			"default_profile_image": false,
			"description": "Quit my city job to write online // helping you find freedom in writing and business // Ghostwriting personal brands at SocialScaler",
			"entities": {
				"description": {
					"urls": []
				},
				"url": {
					"urls": [
						{
							"display_url": "the-viral-supplement.ck.page/signup",
							"expanded_url": "https://the-viral-supplement.ck.page/signup",
							"url": "https://t.co/xCct97IXNY",
							"indices": [
								0,
								23
							]
						}
					]
				}
			},
			"fast_followers_count": 0,
			"favourites_count": 24432,
			"followers_count": 2601,
			"friends_count": 399,
			"has_custom_timelines": true,
			"is_translator": false,
			"listed_count": 41,
			"location": "FREE viral tweet breakdowns ↓",
			"media_count": 420,
			"name": "— Daniel",
			"normal_followers_count": 2601,
			"pinned_tweet_ids_str": [
				"1570381397130637312"
			],
			"possibly_sensitive": false,
			"profile_banner_url": "https://pbs.twimg.com/profile_banners/1158101960/1684436057",
			"profile_image_url_https": "https://pbs.twimg.com/profile_images/1629598305838678016/2qaaBYMb_normal.jpg",
			"profile_interstitial_type": "",
			"screen_name": "_danreynolds_",
			"statuses_count": 10072,
			"translator_type": "none",
			"url": "https://t.co/xCct97IXNY",
			"verified": false,
			"want_retweets": false,
			"withheld_in_countries": []
		},
		"verified_phone_status": false
	}
}
```

# Changelog

This Actor's version history is a separate document: https://apify.com/curious_coder/twitter-replies-scraper/changelog.md

# Actor input Schema

## `cookie` (type: `array`):

Cookie used to authorize actor with twitter.com. Install [Cookie-Editor](https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) chrome extension. Login to your twitter.com account. Click on the extension and export the twitter.com cookies. Insert the contents here

## `tweetUrl` (type: `string`):

URL of the tweet to scrape replies from

## `cursor` (type: `string`):

Cursor value to resume scraping from

## `count` (type: `integer`):

No description

## `minDelay` (type: `integer`):

Minimum duration in seconds to wait before scraping next page

## `maxDelay` (type: `integer`):

Maximum duration in seconds to wait before scraping next page

## Actor input object example

```json
{
  "tweetUrl": "https://twitter.com/elonmusk/status/1692435700275404853",
  "minDelay": 2,
  "maxDelay": 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 = {
    "tweetUrl": "https://twitter.com/elonmusk/status/1692435700275404853",
    "minDelay": 2,
    "maxDelay": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("curious_coder/twitter-replies-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 = {
    "tweetUrl": "https://twitter.com/elonmusk/status/1692435700275404853",
    "minDelay": 2,
    "maxDelay": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("curious_coder/twitter-replies-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 '{
  "tweetUrl": "https://twitter.com/elonmusk/status/1692435700275404853",
  "minDelay": 2,
  "maxDelay": 5
}' |
apify call curious_coder/twitter-replies-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,curious_coder/twitter-replies-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/fhopKrWnm9PWf2OMM/builds/5qK7YUdLWOsJMksUu/openapi.json
