# 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:** 265 total users, 49 monthly users, 31.6% 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/actors/running/actors-in-store.md#pay-per-usage

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

## 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(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 '{
  "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": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,magicfingers/threads-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/eqirspiQiEaNireOn/builds/gCwxt6JOdfWAArAum/openapi.json
