# Meta threads scraper (`curious_coder/threads-scraper`) Actor

Scrape threads or posts from meta or instagram's new social media website "threads.net"

- **URL**: https://apify.com/curious_coder/threads-scraper.md
- **Developed by:** [Curious Coder](https://apify.com/curious_coder) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 1,215 total users, 41 monthly users, 97.3% runs succeeded, 39 bookmarks
- **User rating**: 3.07 out of 5 stars

## Pricing

from $0.50 / 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/actors/running/actors-in-store.md#pay-per-event

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

### Threads scraper

This scraper helps you to scrape posts by a threads user

Here is the sample output of this actor:

```json
{
	"id": "3141737961795561608_314216",
	"reply_count": "27068",
	"user": {
		"profile_pic_url": "https://scontent.cdninstagram.com/v/t51.2885-19/357376107_1330597350674698_8884059223384672080_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent.cdninstagram.com&_nc_cat=1&_nc_ohc=euIj8dtTGIkAX-vea85&edm=APs17CUBAAAA&ccb=7-5&oh=00_AfCOXYuDeJ_OxBW9ZYSdlTfCIXdP9NBqDoMVS5rk39mEHA&oe=64ACDDC0&_nc_sid=10d13b",
		"username": "zuck",
		"id": null,
		"is_verified": true,
		"pk": "314216"
	},
	"image_versions2": {
		"candidates": []
	},
	"original_width": 612,
	"original_height": 612,
	"video_versions": [],
	"carousel_media": null,
	"carousel_media_count": null,
	"pk": "3141737961795561608",
	"has_audio": null,
	"text_post_app_info": {
		"link_preview_attachment": null,
		"share_info": {
			"quoted_post": null,
			"reposted_post": null
		},
		"reply_to_author": null,
		"is_post_unavailable": false
	},
	"caption": {
		"text": "70 million sign ups on Threads as of this morning. Way beyond our expectations."
	},
	"taken_at": 1688744372,
	"like_count": 146411,
	"code": "CuZsgfWLyiI",
	"media_overlay_info": null
}

```

### Documentation for JSON Data

The given JSON data represents an threads post with various associated attributes. Below is a breakdown of the individual components and their descriptions:

### Main Object

- **id**: The unique identifier for the post.
  - *Type*: String
  - *Example*: "3141737961795561608_314216"

- **reply_count**: The total number of replies for this post.
  - *Type*: String
  - *Example*: "27068"

- **user**: The user who created the post. This contains several sub-fields:
  - **profile_pic_url**: The URL of the user's profile picture.
    - *Example*: A direct link to the image.
  - **username**: The username of the user.
    - *Example*: "zuck"
  - **id**: The unique identifier for the user. (Can be null)
  - **is_verified**: A boolean value indicating if the user is verified.
  - **pk**: A unique key representing the user.
    - *Type*: String
    - *Example*: "314216"

- **image_versions2**: An object that lists image versions available for the post.
  - **candidates**: An array containing different image versions.

- **original_width**: The original width of the image or video.
  - *Type*: Integer
  - *Example*: 612

- **original_height**: The original height of the image or video.
  - *Type*: Integer
  - *Example*: 612

- **video_versions**: An array containing different versions of the video (if the post is a video).

- **carousel_media**: Represents carousel media if the post contains multiple images or videos.

- **carousel_media_count**: The total number of media items in a carousel post.

- **pk**: Another unique key for the post.
  - *Type*: String
  - *Example*: "3141737961795561608"

- **has_audio**: A boolean value indicating if the post (video) has audio.

- **text_post_app_info**: Contains information related to the text of the post.
  - **link_preview_attachment**: Any link preview attached to the post.
  - **share_info**: Information related to post sharing.
    - **quoted_post**: If the post quotes another post.
    - **reposted_post**: If the post is a repost from another user.
  - **reply_to_author**: Represents a reply to the post author.
  - **is_post_unavailable**: A boolean indicating if the post is unavailable.

- **caption**: Contains the caption of the post.
  - **text**: The text content of the caption.
    - *Example*: "70 million sign ups on Threads as of this morning. Way beyond our expectations."

- **taken_at**: A timestamp indicating when the post was created (in Unix time format and can be converted to a human-readable date and time format.)
  - *Type*: Integer
  - *Example*: 1688744372

- **like_count**: The total number of likes for the post.
  - *Type*: Integer
  - *Example*: 146411

- **code**: A unique code associated with the post.
  - *Type*: String
  - *Example*: "CuZsgfWLyiI"

- **media_overlay_info**: Contains information related to any media overlays on the post.

# Changelog

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

# Actor input Schema

## `urls` (type: `array`):

No description

## `postsPerSource` (type: `integer`):

Limit the number posts scraped per given source (URL or @Username)

## Actor input object example

```json
{
  "urls": [
    "@zuck"
  ],
  "postsPerSource": 25
}
```

# 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 = {
    "urls": [
        "@zuck"
    ],
    "postsPerSource": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("curious_coder/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 = {
    "urls": ["@zuck"],
    "postsPerSource": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("curious_coder/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 '{
  "urls": [
    "@zuck"
  ],
  "postsPerSource": 25
}' |
apify call curious_coder/threads-scraper --silent --output-dataset

```

## MCP server setup

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