# Twitter Follower/Following/Verified Scraper (`dead00/twitter-follower-following-verified-scraper`) Actor

A Twitter Scraper that scrapes followers/following and verified follower/following data.

- **URL**: https://apify.com/dead00/twitter-follower-following-verified-scraper.md
- **Developed by:** [Dead](https://apify.com/dead00) (community)
- **Categories:** Social media, Developer tools, Lead generation
- **Stats:** 178 total users, 4 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 4.80 out of 5 stars

## Pricing

$4.00 / 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/platform/actors/running/actors-in-store#pay-per-event

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

A Twitter Scraper that scrapes followers/following and verified follower/following data using authenticated requests. This scraper can extract detailed user information including verification status, profile data, and social metrics.

### Features

- **Multiple Scraping Types**: Scrape followers, following, or filter for verified users only
- **Batch Processing**: Process multiple usernames in a single run
- **Rich User Data**: Extract comprehensive profile information including:
  - Basic profile data (name, username, description)
  - Social metrics (followers, following, tweets count)
  - Verification status and details
  - Profile images (standard and high-resolution)
  - Account creation date and location
- **Verification Filtering**: Option to scrape only verified users
- **Rate Limit Handling**: Built-in delays to respect Twitter's API limits
- **Error Handling**: Robust error handling with detailed logging

### Input Parameters

Configure the scraper using these input parameters:

#### Required Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `username` | Array\[String] | List of Twitter usernames to scrape (without @ symbol) |
| `cookies` | Array\[Object] | Authentication cookies from your Twitter session |

#### Optional Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `scrape_type` | String | `"followers"` | Type of data to scrape |
| `follower_limit` | Number | `100` | Maximum number of followers/following to scrape per username |

#### Scrape Types

- `"followers"` - Scrape followers of the specified users
- `"following"` - Scrape users that the specified users are following
- `"verified_followers"` - Scrape only verified followers
- `"verified_following"` - Scrape only verified users that the specified users are following

### Authentication Setup

This scraper requires Twitter authentication cookies. Here's how to obtain them:

1. **Login to Twitter** in your browser
2. **Open Developer Tools** (F12)
3. **Go to Application/Storage tab** → Cookies → https://twitter.com
4. **Export the following cookies**:
   ```json
   [
     {"name": "auth_token", "value": "your_auth_token_value"},
     {"name": "ct0", "value": "your_ct0_value"},
     {"name": "twid", "value": "your_twid_value"}
   ]
   ```

#### Cookie Format

Each cookie object should contain:

```json
{
  "name": "cookie_name",
  "value": "cookie_value"
}
```

### Input Example

```json
{
  "username": ["elonmusk", "sundarpichai", "satyanadella"],
  "scrape_type": "followers",
  "follower_limit": 500,
  "cookies": [
    {"name": "auth_token", "value": "your_auth_token"},
    {"name": "ct0", "value": "your_csrf_token"},
    {"name": "twid", "value": "your_twitter_id"}
  ]
}
```

### Output Data

The scraper extracts the following data for each user:

#### Basic Information

- `id` - Twitter user ID
- `username` - Twitter handle (without @)
- `name` - Display name
- `description` - Bio/description

#### Social Metrics

- `followers_count` - Number of followers
- `following_count` - Number of accounts following
- `tweets_count` - Total number of tweets

#### Verification Details

- `verified` - Overall verification status (boolean)
- `verification_details` - Detailed verification information:
  - `verified_type` - Type of verification
  - `blue_verified` - Twitter Blue verification
  - `legacy_verified` - Legacy blue checkmark
  - `government_verified` - Government account verification
  - `business_verified` - Business account verification

#### Profile Assets

- `profile_image_url` - Standard profile image URL
- `profile_image_url_hd` - High-resolution profile image URL
- `profile_banner_url` - Profile banner image URL
- `profile_background_image_url` - Background image URL

#### Additional Data

- `created_at` - Account creation date
- `location` - User's location (if provided)
- `url` - Website URL (if provided)
- `protected` - Whether the account is private
- `scraped_from` - Username this data was scraped from
- `scrape_type` - Type of scraping performed

### Usage Tips

1. **Start Small**: Begin with a low `follower_limit` to test your setup
2. **Monitor Rate Limits**: The scraper includes delays, but be mindful of Twitter's limits
3. **Verified Users**: Use verified filtering to get higher-quality data
4. **Batch Processing**: Process multiple usernames efficiently in one run
5. **Data Storage**: Results are automatically saved to Apify dataset

### Rate Limiting

The scraper implements several rate limiting strategies:

- 1-second delay between pagination requests
- 2-second delay between different usernames
- Automatic error handling for rate limit responses

### Error Handling

The scraper handles various error scenarios:

- Invalid usernames
- Authentication failures
- Network connectivity issues
- Rate limiting
- Private/suspended accounts

All errors are logged with detailed information for debugging.

### Requirements

- **Apify Account**: Required to run this actor
- **Valid Twitter Cookies**: Fresh authentication cookies from an active Twitter session
- **Internet Connection**: For API requests to Twitter

### Limitations

- Requires valid Twitter authentication
- Subject to Twitter's rate limiting
- Cannot access private accounts unless you follow them
- Suspended or deleted accounts will be skipped

### Troubleshooting

#### Authentication Issues

- Ensure cookies are fresh (less than 24 hours old)
- Check that all required cookies are provided
- Verify cookie values are complete and unmodified

#### Rate Limiting

- Reduce `follower_limit` if hitting rate limits
- Increase delays between requests if needed
- Use fewer usernames per run

#### No Data Returned

- Verify usernames exist and are public
- Check if accounts have followers/following to scrape
- Ensure proper scrape\_type is selected

### Legal and Ethical Considerations

- Respect Twitter's Terms of Service
- Use scraped data responsibly
- Consider privacy implications
- Don't overwhelm Twitter's servers
- Comply with applicable data protection laws

# Actor input Schema

## `username` (type: `array`):

Twitter usernames to scrape followers from (without @)

## `scrape_type` (type: `string`):

What to scrape

## `follower_limit` (type: `integer`):

Maximum number of followers to scrape per username (for verified-only options, this is the limit after filtering)

## `cookies` (type: `array`):

Twitter cookies for authentication (array of objects with name and value)

## `headless` (type: `boolean`):

Run browser in headless mode

## `proxy` (type: `object`):

HTTP proxy configuration (residential US proxies recommended for better rate limits)

## Actor input object example

```json
{
  "username": [
    "elonmusk"
  ],
  "scrape_type": "followers",
  "follower_limit": 20,
  "cookies": [
    {
      "domain": ".x.com",
      "expirationDate": 1811412982.846718,
      "hostOnly": false,
      "httpOnly": true,
      "name": "auth_token",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "92e7877bdfd87af908c6d539dc65862288966c24"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814436958.223783,
      "hostOnly": false,
      "httpOnly": false,
      "name": "guest_id",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "v1%3A177987695684429428"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1811917497.061782,
      "hostOnly": false,
      "httpOnly": false,
      "name": "twid",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "u%3D1877748387220799489"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1780986292.806873,
      "hostOnly": false,
      "httpOnly": false,
      "name": "external_referer",
      "path": "/",
      "sameSite": null,
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "padhuUp37zjgzgv1mFWxJ12Ozwit7owX|0|8e8t2xd8A2w%3D"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1780383226.297378,
      "hostOnly": false,
      "httpOnly": true,
      "name": "__cf_bm",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "kWf2gTNFMJvjyHttIhHsPZm4px0RGOYtSUhrPqCbiG4-1780381424.1058052-1.0.1.1-YwCQ9XBoVjijH_BW9CyZNEYD1fdoXjzw8xKevJnVyfFoy3hcphRvWht_noPBUpFavGNAQQjdnSsRk97RynpYsdsh.AYnr4orpLCrEUheN2gjbduH40dY2Ef.41_PXdZF"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814436983.209681,
      "hostOnly": false,
      "httpOnly": false,
      "name": "ct0",
      "path": "/",
      "sameSite": "lax",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "2b28db60d87508ecd1aacb5b3eaabde0422a8c9054be2941a646c2f209eda73f2ad0421b538daf177411196f0adcadd5bfd4d33d0f7917e2f91d0ebb236d103569c557ba992533de64507d6bae59b7f7"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814437000.946302,
      "hostOnly": false,
      "httpOnly": false,
      "name": "dnt",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "1"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814941491.70758,
      "hostOnly": false,
      "httpOnly": false,
      "name": "guest_id_ads",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "v1%3A177987695684429428"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814941491.707756,
      "hostOnly": false,
      "httpOnly": false,
      "name": "guest_id_marketing",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "v1%3A177987695684429428"
    },
    {
      "domain": ".x.com",
      "expirationDate": 1814436971.485391,
      "hostOnly": false,
      "httpOnly": false,
      "name": "personalization_id",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": null,
      "value": "\"v1_5FpDOs5xe3AmAR2jzHPTfA==\""
    }
  ],
  "headless": true,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("dead00/twitter-follower-following-verified-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 = { "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    } }

# Run the Actor and wait for it to finish
run = client.actor("dead00/twitter-follower-following-verified-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call dead00/twitter-follower-following-verified-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=dead00/twitter-follower-following-verified-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wXebvXyOox2ZXn3v8/builds/2XiNvv0J9G1bOakTn/openapi.json
