# Xiaohongshu (RedNote) Comments & Replies Scraper (`unitbytes/xiaohongshu-rednote-comments-scraper`) Actor

The fastest and most affordable Xiaohongshu (RedNote / 小红书) comments scraper. Deep nested replies, author profiles, verified like counts, and IP locations.

- **URL**: https://apify.com/unitbytes/xiaohongshu-rednote-comments-scraper.md
- **Developed by:** [UnitBytes | Enterprise Web Data](https://apify.com/unitbytes) (community)
- **Categories:** Social media, Lead generation, Marketing
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 scraped comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

<p align="center">
  <a href="https://console.apify.com/actors/J55L2GH0KEEdhqxfA/input" target="_blank">
    <img src="https://raw.githubusercontent.com/unitbytes-com/.github/main/assets/banners/unitbytes-xiaohongshu-rednote-comments-sentiment-scraper-banner.jpg" alt="Xiaohongshu Comments & Replies Scraper by UnitBytes" width="100%" />
  </a>
</p>

<p align="center">
  <a href="https://console.apify.com/actors/J55L2GH0KEEdhqxfA/input" target="_blank">
    <img src="https://raw.githubusercontent.com/unitbytes-com/.github/main/assets/try-it-for-free.svg" width="240" height="48" alt="Try it for Free">
  </a>
  <br>
  <sub>⚡ <b>1-Click Free Trial:</b> Test live queries using Apify's $5 free monthly credit • No credit card required</sub>
</p>

## 💬 Xiaohongshu (RedNote) Comments & Replies Scraper

Extract **high-value comments, nested replies ("楼中楼"), author metadata, verified like metrics, and IP locations** from any Xiaohongshu (RedNote / 小红书) post in seconds—with **Zero Login & Zero Cookies Needed**.

***

### ⚡ Why Scrape Xiaohongshu Comments?

Xiaohongshu comments are a goldmine for e-commerce brands, dropshippers, and market intelligence researchers:

1. **Direct Customer Feedback:** Uncover authentic consumer reactions, opinions, and questions about products and trending posts.
2. **Competitor & Market Research:** Discover what real consumers love or hate about competing cosmetics, apparel, or electronics before launching your product.
3. **Influencer Authenticity Audits:** Distinguish genuine high-engagement creator communities from artificial bot spam.
4. **Deep Nested Reply Trees:** Most scrapers only capture preview comments. This scraper extracts the **complete conversational tree**, including replies between users.

***

### ✨ Features

- 💬 **Full Comment Trees:** Scrapes both root top-level comments and nested reply chains ("楼中楼") with full hierarchy.
- 📍 **Geographic Intelligence:** Captures author **IP location** (province, city, and country) for regional market segmentation.
- 🔍 **Clean Data Integrity:** Automatic numerical parsing of Chinese scale metrics (`万`, `k`, `亿`), ISO-8601 timestamps, and unexpiring permanent image CDNs.
- ⚡ **Instant High-Speed Extraction:** Delivers hundreds of comments in seconds with maximum throughput and zero waiting time.
- 🛡️ **100% Maintenance-Free Reliability:** Autonomous platform resilience guarantees stable, uninterrupted data collection.
- 💰 **Pay-Per-Event (PPE) Pricing:** Predictable, transparent pricing with **zero compute charges**—you only pay for delivered data.

***

### 💰 Pricing (Pay-Per-Event)

This Actor uses Apify's **Pay-Per-Event (PPE)** pricing model. You only pay for the actual comments successfully scraped into your dataset—**never for idle time, proxy traffic, or compute units**:

| Event | Free Tier | Bronze Tier | Silver Tier | Gold Tier | Description |
|---|---|---|---|---|---|
| **Actor Start** | $0.05 | $0.05 | $0.05 | $0.05 | One-time fixed startup fee per run. |
| **Scraped Comment** | **$0.00249** | **$0.00229** | **$0.00209** | **$0.00199** | Charged per comment / nested reply delivered to your dataset. |

*Cost Example:* Scraping 1,000 comments costs only **~$2.54 total** (Start fee + $2.49). No hidden server or proxy charges.

***

### 🔗 Supported Input Formats

You can pass Xiaohongshu notes in multiple convenient formats:

1. **Full Web URLs with token (Recommended):** `https://www.xiaohongshu.com/explore/64256e08000000001300575e?xsec_token=...`
2. **Mobile App Share Links:** `http://xhslink.com/a/...` (Automatically resolved to full URLs via high-speed HTTP redirects).
3. **Bare 24-character Note IDs:** `64256e08000000001300575e`

***

> \[!NOTE]
>
> ### 📌 Xiaohongshu Platform Comment Limits
>
> Xiaohongshu (RedNote) manages comment accessibility via platform-level pagination limits:
>
> - **Anonymous Guest Mode (Default):** Requires zero cookies or account setup. Xiaohongshu serves the first public page (typically **~20 to 50 top-level comments** plus their nested replies) to unauthenticated visitors.
> - **Deep Pagination (>20–50 Comments):** To paginate deeper into large posts, provide your logged-in session cookie (`web_session=...`) in the optional `sessionCookie` input parameter.
> - **Platform Ceiling:** Even with logged-in cookies, Xiaohongshu's web API enforces an upper pagination ceiling per post (typically capping results at a few hundred comments). The actor extracts 100% of all comments that the platform makes available.

***

### 📥 Input Parameters

| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
| `startUrls` | Array | **Yes** | Post links (e.g. `https://www.xiaohongshu.com/explore/66e...`), bare 24-character note IDs, or mobile share links (`xhslink.com/...`). | Prefilled |
| `maxCommentsPerNote` | Integer | No | Maximum top-level comments to fetch per post (1 to 2,000). *Note: Anonymous guest mode caps at ~20-50 comments; provide sessionCookie for deeper extraction.* | `50` |
| `includeSubComments` | Boolean | No | When enabled, fetches nested replies underneath each root comment. | `true` |
| `maxSubCommentsPerComment` | Integer | No | Maximum nested replies to collect per comment (0 to 100). | `10` |
| `sessionCookie` | String | No | Optional logged-in cookie (`web_session=...`) for deep comment pagination (>20 comments). | `None` |
| `proxyConfiguration` | Object | **Yes** | Apify Residential Proxy is strictly required. | `RESIDENTIAL` |

***

### 📤 Sample Output JSON (1 Row = 1 Comment)

```json
[
  {
    "id": "645a340a000000001500e209",
    "noteId": "645a13770000000014027734",
    "noteUrl": "https://www.xiaohongshu.com/explore/645a13770000000014027734",
    "content": "鞋子跟样貌一样吸睛[飞吻R][飞吻R][飞吻R]",
    "likeCount": 18,
    "subCommentCount": 1,
    "isSubComment": false,
    "targetCommentId": "",
    "parentCommentId": "",
    "ipLocation": "马来西亚",
    "createTime": 1683633162000,
    "createdAt": "2023-05-09T11:52:42Z",
    "author": {
      "id": "628748700000000021022fa0",
      "nickname": "双鱼座老女孩",
      "avatar": "https://sns-avatar-qc.xhscdn.com/avatar/634e99245e86e230b011a111.jpg",
      "profileUrl": "https://www.xiaohongshu.com/user/profile/628748700000000021022fa0",
      "ipLocation": "马来西亚"
    }
  },
  {
    "id": "645a3517000000000a000ecb",
    "noteId": "645a13770000000014027734",
    "noteUrl": "https://www.xiaohongshu.com/explore/645a13770000000014027734",
    "content": "求同款裙子链接！🔗 多少钱入手的？",
    "likeCount": 6,
    "subCommentCount": 0,
    "isSubComment": true,
    "targetCommentId": "645a340a000000001500e209",
    "parentCommentId": "645a340a000000001500e209",
    "ipLocation": "上海",
    "createTime": 1683633431000,
    "createdAt": "2023-05-09T11:57:11Z",
    "author": {
      "id": "5c6b6a31000000001203525f",
      "nickname": "茜茜笑熹熹🐥",
      "avatar": "https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo321jbg6787o105n3bd8okmkivcqib7n0.jpg",
      "profileUrl": "https://www.xiaohongshu.com/user/profile/5c6b6a31000000001203525f",
      "ipLocation": "上海"
    }
  }
]
```

***

### 💬 Enterprise Support & Custom Pipelines

Need custom web data feeds, high-frequency scheduled runs, private cluster deployments, or dedicated SLAs?

- 📧 **Direct Email**: <contact@unitbytes.com>
- 🌐 **Enterprise Platform**: <https://unitbytes.com>
- 💡 **Data Engine Specs & Live Docs**: <https://unitbytes.com/actors/xiaohongshu-comments-scraper/>

# Actor input Schema

## `startUrls` (type: `array`):

Paste one or more Xiaohongshu post URLs (e.g. 'https://www.xiaohongshu.com/explore/66e...'), bare 24-character hex note IDs, or mobile share links ('xhslink.com/...') to extract full comment threads.

## `maxCommentsPerNote` (type: `integer`):

Maximum number of top-level comments to extract per note (1 to 2,000). Note: Xiaohongshu platform limits anonymous public access to ~20-50 comments per post. To paginate deeper into large threads, provide an optional 'sessionCookie'.

## `includeSubComments` (type: `boolean`):

When enabled, scrapes deep nested reply threads ('楼中楼') underneath each parent comment.

## `maxSubCommentsPerComment` (type: `integer`):

Maximum number of nested replies to fetch per top-level comment (0 to 100).

## `sessionCookie` (type: `string`):

Optional logged-in Xiaohongshu cookie (e.g. 'web_session=...' or full cookie string) for deep pagination (>20 comments per note). Zero setup is required for standard note scraping (first page).

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

Apify Residential Proxy is strictly required. Xiaohongshu (RedNote) blocks datacenter and non-sticky IP addresses.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.xiaohongshu.com/explore/64256e08000000001300575e?xsec_token=ABivcR3TWdHqjbjX2xyNQkAS3_CZsrXHUX9r1tNqo4148=&xsec_source=pc_feed"
    }
  ],
  "maxCommentsPerNote": 50,
  "includeSubComments": true,
  "maxSubCommentsPerComment": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "HK"
  }
}
```

# Actor output Schema

## `commentsDataset` (type: `string`):

Extracted Xiaohongshu comments, nested replies, author metadata, verified metrics, and timestamps

# 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 = {
    "startUrls": [
        {
            "url": "https://www.xiaohongshu.com/explore/64256e08000000001300575e?xsec_token=ABivcR3TWdHqjbjX2xyNQkAS3_CZsrXHUX9r1tNqo4148=&xsec_source=pc_feed"
        }
    ],
    "maxCommentsPerNote": 50,
    "maxSubCommentsPerComment": 10,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "HK"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("unitbytes/xiaohongshu-rednote-comments-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 = {
    "startUrls": [{ "url": "https://www.xiaohongshu.com/explore/64256e08000000001300575e?xsec_token=ABivcR3TWdHqjbjX2xyNQkAS3_CZsrXHUX9r1tNqo4148=&xsec_source=pc_feed" }],
    "maxCommentsPerNote": 50,
    "maxSubCommentsPerComment": 10,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "HK",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("unitbytes/xiaohongshu-rednote-comments-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 '{
  "startUrls": [
    {
      "url": "https://www.xiaohongshu.com/explore/64256e08000000001300575e?xsec_token=ABivcR3TWdHqjbjX2xyNQkAS3_CZsrXHUX9r1tNqo4148=&xsec_source=pc_feed"
    }
  ],
  "maxCommentsPerNote": 50,
  "maxSubCommentsPerComment": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "HK"
  }
}' |
apify call unitbytes/xiaohongshu-rednote-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,unitbytes/xiaohongshu-rednote-comments-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/J55L2GH0KEEdhqxfA/builds/yfejtmm09efOVwpRp/openapi.json
