# Threads Scraper (`magicfingers/threads-scraper`) Actor

Scrape Threads (by Meta) public data: user profiles, posts/threads, replies, and keyword search. Extracts follower counts, engagement metrics, media URLs, and more.

- **URL**: https://apify.com/magicfingers/threads-scraper.md
- **Developed by:** [abdulrahman alrashid](https://apify.com/magicfingers) (community)
- **Categories:** Social media
- **Stats:** 114 total users, 34 monthly users, 69.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Threads Scraper — Profiles, Posts, Replies & Search

Scrape public data from [Threads](https://www.threads.net) (by Meta) at scale. Extract user profiles, posts, replies to any thread, and search results by keyword or hashtag.

### What does Threads Scraper do?

Threads has over 200M+ users and is one of the fastest-growing social platforms. This actor lets you collect structured data from Threads without needing any login or API key.

#### Features

- **User Profiles** — username, display name, bio, follower/following counts, verified status, profile picture URL
- **User Posts** — full text, image/video URLs, like count, reply count, repost count, timestamps
- **Thread Replies** — all replies to a specific thread with author info and engagement metrics
- **Keyword Search** — search threads by any keyword or hashtag
- **Pagination** — configurable result limits (up to 500 per query)
- **Anti-detection** — user-agent rotation, random delays, browser fingerprint masking

### Input

| Field | Type | Description |
|-------|------|-------------|
| `scrapeType` | string | One of: `profiles`, `userPosts`, `threadReplies`, `search` |
| `usernames` | string[] | Threads usernames (without @). For `profiles` and `userPosts` |
| `threadUrls` | string[] | Full thread URLs. For `threadReplies` |
| `searchQueries` | string[] | Keywords/hashtags to search. For `search` |
| `maxResults` | integer | Max results per query (default: 25, max: 500) |
| `includeReplies` | boolean | Include user's replies when scraping posts (default: false) |
| `proxyConfiguration` | object | Proxy settings (residential recommended) |

#### Example input — Scrape profiles

```json
{
    "scrapeType": "profiles",
    "usernames": ["zuck", "mosseri"],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"]
    }
}
````

#### Example input — Scrape posts

```json
{
    "scrapeType": "userPosts",
    "usernames": ["zuck"],
    "maxResults": 50,
    "includeReplies": false
}
```

#### Example input — Search

```json
{
    "scrapeType": "search",
    "searchQueries": ["artificial intelligence", "#tech"],
    "maxResults": 100
}
```

#### Example input — Thread replies

```json
{
    "scrapeType": "threadReplies",
    "threadUrls": ["https://www.threads.net/@zuck/post/ABC123"],
    "maxResults": 50
}
```

### Output

#### Profile output

```json
{
    "type": "profile",
    "userId": "314216",
    "username": "zuck",
    "displayName": "Mark Zuckerberg",
    "bio": "Building the future...",
    "followerCount": 12500000,
    "followingCount": 450,
    "isVerified": true,
    "profilePicUrl": "https://scontent...",
    "url": "https://www.threads.net/@zuck",
    "scrapedAt": "2025-01-15T10:30:00.000Z"
}
```

#### Post output

```json
{
    "type": "post",
    "postId": "3456789012345678",
    "code": "CxAbCdEfG",
    "authorUsername": "zuck",
    "authorDisplayName": "Mark Zuckerberg",
    "authorVerified": true,
    "text": "Excited to share what we've been working on...",
    "likeCount": 45000,
    "replyCount": 1200,
    "repostCount": 3400,
    "quoteCount": 560,
    "imageUrls": ["https://scontent..."],
    "videoUrls": [],
    "timestamp": "2025-01-15T08:00:00.000Z",
    "url": "https://www.threads.net/@zuck/post/CxAbCdEfG",
    "scrapedAt": "2025-01-15T10:30:00.000Z"
}
```

### How it works

The scraper uses a dual approach:

1. **GraphQL API (primary)** — Makes direct requests to Threads' internal GraphQL endpoints from a browser context, extracting structured data with full engagement metrics
2. **Page scraping (fallback)** — If the API approach is blocked, falls back to rendering the full page with Playwright and extracting data from the DOM

Both methods run inside a real Chromium browser with anti-detection measures to avoid blocks.

### Proxy recommendations

Threads actively blocks datacenter IPs. For reliable results, use **residential proxies**:

```json
{
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"]
    }
}
```

### Pricing

This actor uses the **Pay-Per-Event** pricing model at **$0.60 per 1,000 results** ($0.0006 per result).

### Limitations

- Only public profiles and posts can be scraped (no login required, no private data)
- Threads may rate-limit or temporarily block IPs — residential proxies are strongly recommended
- Engagement metrics (likes, replies, reposts) are available via the GraphQL approach; the page fallback may return null for some metrics
- Search is limited to what Threads exposes publicly on their search page

### Changelog

- **1.0.0** — Initial release: profiles, posts, replies, search with GraphQL + page fallback

# Actor input Schema

## `scrapeType` (type: `string`):

Choose what to scrape.

## `usernames` (type: `array`):

List of Threads usernames to scrape (without @). Used for 'profiles' and 'userPosts' scrape types.

## `threadUrls` (type: `array`):

Full Threads post URLs to scrape replies from. Used for 'threadReplies' scrape type.

## `searchQueries` (type: `array`):

Keywords or hashtags to search for. Used for 'search' scrape type.

## `maxResults` (type: `integer`):

Maximum number of results to return per username, URL, or search query.

## `includeReplies` (type: `boolean`):

When scraping user posts, also include their replies to other threads.

## `proxyConfiguration` (type: `object`):

Proxy settings. Residential proxies recommended for Threads.

## Actor input object example

```json
{
  "scrapeType": "profiles",
  "usernames": [
    "zuck",
    "mosseri"
  ],
  "maxResults": 5,
  "includeReplies": false,
  "proxyConfiguration": {
    "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 = {
    "scrapeType": "profiles",
    "usernames": [
        "zuck"
    ],
    "maxResults": 5,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("magicfingers/threads-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 = {
    "scrapeType": "profiles",
    "usernames": ["zuck"],
    "maxResults": 5,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("magicfingers/threads-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 '{
  "scrapeType": "profiles",
  "usernames": [
    "zuck"
  ],
  "maxResults": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call magicfingers/threads-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Threads Scraper",
        "description": "Scrape Threads (by Meta) public data: user profiles, posts/threads, replies, and keyword search. Extracts follower counts, engagement metrics, media URLs, and more.",
        "version": "1.0",
        "x-build-id": "gCwxt6JOdfWAArAum"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/magicfingers~threads-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-magicfingers-threads-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/magicfingers~threads-scraper/runs": {
            "post": {
                "operationId": "runs-sync-magicfingers-threads-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/magicfingers~threads-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-magicfingers-threads-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "scrapeType"
                ],
                "properties": {
                    "scrapeType": {
                        "title": "Scrape Type",
                        "enum": [
                            "profiles",
                            "userPosts",
                            "threadReplies",
                            "search"
                        ],
                        "type": "string",
                        "description": "Choose what to scrape.",
                        "default": "profiles"
                    },
                    "usernames": {
                        "title": "Usernames",
                        "type": "array",
                        "description": "List of Threads usernames to scrape (without @). Used for 'profiles' and 'userPosts' scrape types.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "threadUrls": {
                        "title": "Thread URLs",
                        "type": "array",
                        "description": "Full Threads post URLs to scrape replies from. Used for 'threadReplies' scrape type.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchQueries": {
                        "title": "Search Queries",
                        "type": "array",
                        "description": "Keywords or hashtags to search for. Used for 'search' scrape type.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max Results Per Query",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of results to return per username, URL, or search query.",
                        "default": 5
                    },
                    "includeReplies": {
                        "title": "Include Replies in User Posts",
                        "type": "boolean",
                        "description": "When scraping user posts, also include their replies to other threads.",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings. Residential proxies recommended for Threads."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
