# Xiaohongshu Comments Scraper 💬 (`shahidirfan/xiaohongshu-comments-scraper`) Actor

Extract Xiaohongshu (Little Red Book/RED) post comments, replies, usernames, timestamps, likes, and engagement data. Ideal for social media monitoring, sentiment analysis, influencer research, customer feedback, brand intelligence, and AI training datasets.

- **URL**: https://apify.com/shahidirfan/xiaohongshu-comments-scraper.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Stats:** 3 total users, 2 monthly users, 100.0% 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?

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

### What does Xiaohongshu Comments Scraper do?

Xiaohongshu Comments Scraper collects public comments from a Xiaohongshu (小红书 / RedNote) note and saves them as structured rows. Paste a note link, an app share link, share text, or a 24 character note id. The Actor returns comment text, author details, likes, reply counts, IP location, timestamps, attached pictures, and the replies Xiaohongshu shows with each comment.

You do not need a Xiaohongshu account or cookie to run it.

### Why use Xiaohongshu Comments Scraper?

- **Clean comment datasets** - one row per top-level comment, with replies nested in the same record.
- **No manual copying** - collect a full comment page, paginate automatically, and export from Apify.
- **Useful context** - author names, avatars, likes, reply counts, IP location, and timestamps are included when Xiaohongshu publishes them.
- **Flexible input** - links, share text, and bare note ids all work.
- **Automation ready** - schedule runs, call the Actor through the Apify API, or send results to spreadsheets and webhooks.

Typical uses include sentiment analysis, product feedback review, content research, influencer research, community monitoring, and building datasets for AI or RAG workflows.

### What data can you extract from Xiaohongshu?

| Field               | Description                                   |
| ------------------- | --------------------------------------------- |
| `comment_id`        | Unique comment identifier                     |
| `content`           | Comment text                                  |
| `user_name`         | Comment author display name                   |
| `user_id`           | Comment author id                             |
| `user_avatar`       | Author avatar URL                             |
| `like_count`        | Likes on the comment                          |
| `sub_comment_count` | Number of replies under the comment           |
| `ip_location`       | Location shown by Xiaohongshu                 |
| `create_time`       | Comment time in ISO format                    |
| `pictures`          | Image or sticker URLs attached to the comment |
| `at_users`          | Users mentioned in the comment                |
| `sub_comments`      | Replies returned with the comment             |
| `note_id`           | Source note id                                |
| `note_url`          | Source note URL                               |

### How to use Xiaohongshu Comments Scraper

1. Open the Actor on Apify.
2. Paste a note link, share link, share text, or 24 character note id into **Note URL or share link**.
3. Set the maximum number of comments and pages.
4. Keep **Include embedded replies** on if you want the replies Xiaohongshu returns with each comment.
5. Run the Actor.
6. Download the dataset as JSON, CSV, Excel, or XML, or connect it to another tool.

### Input Parameters

| Parameter            | Type    | Required | Default      | Description                                                                |
| -------------------- | ------- | -------- | ------------ | -------------------------------------------------------------------------- |
| `startUrl`           | String  | No       | Example note | Note link, discovery link, share link, share text, or 24 character note id |
| `results_wanted`     | Integer | No       | `20`         | Maximum top-level comment rows to save                                     |
| `max_pages`          | Integer | No       | `10`         | Maximum comment pages to request                                           |
| `include_replies`    | Boolean | No       | `true`       | Attach embedded replies under `sub_comments`                               |
| `proxyConfiguration` | Object  | No       | None         | Optional proxy settings for repeated runs                                  |

Each page contains up to 20 top-level comments. `max_pages` limits requests, while `results_wanted` limits saved rows.

### Output Data

| Field               | Type    | Description                              |
| ------------------- | ------- | ---------------------------------------- |
| `note_id`           | String  | Source note id                           |
| `note_url`          | String  | Source note URL                          |
| `comment_id`        | String  | Comment id                               |
| `parent_comment_id` | String  | Comment this row replies to              |
| `root_comment_id`   | String  | Top-level comment that starts the thread |
| `target_comment`    | Object  | Parent comment metadata for replies      |
| `is_reply`          | Boolean | True for a reply row                     |
| `user_id`           | String  | Author id                                |
| `user_name`         | String  | Author name                              |
| `user_avatar`       | String  | Author avatar URL                        |
| `content`           | String  | Comment text                             |
| `like_count`        | Number  | Like count                               |
| `sub_comment_count` | Number  | Reply count                              |
| `ip_location`       | String  | IP location shown by Xiaohongshu         |
| `create_time`       | String  | ISO timestamp                            |
| `create_time_unix`  | Number  | Unix timestamp in milliseconds           |
| `at_users`          | Array   | Mentioned users                          |
| `pictures`          | Array   | Attached image URLs                      |
| `comment_type`      | Number  | Xiaohongshu comment type                 |
| `sub_comments`      | Array   | Embedded replies                         |

### Usage Examples

#### Collect comments from a note link

Use a standard note link when you already have one.

```json
{
    "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076",
    "results_wanted": 50,
    "max_pages": 3
}
```

#### Collect from an app share link

Paste the link copied from the Xiaohongshu app. Share text that contains a link also works.

```json
{
    "startUrl": "https://xhslink.com/o/6Srws5j6eDD",
    "results_wanted": 50,
    "max_pages": 3
}
```

#### Collect replies with a larger limit

Keep replies enabled and raise the limits for a fuller thread.

```json
{
    "startUrl": "69bd1074000000001a035076",
    "results_wanted": 200,
    "max_pages": 10,
    "include_replies": true
}
```

#### Use a proxy

Add a proxy only when repeated runs hit rate limits.

```json
{
    "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076",
    "results_wanted": 100,
    "max_pages": 5,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"]
    }
}
```

### Sample Output

```json
{
    "note_id": "69bd1074000000001a035076",
    "note_url": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076",
    "comment_id": "69be254a000000000d03546b",
    "parent_comment_id": null,
    "root_comment_id": null,
    "is_reply": false,
    "user_id": "5e86ede5000000000100a7cc",
    "user_name": "派小星Panda",
    "user_avatar": "https://sns-avatar-qc.xhscdn.com/avatar/6242a17e5c0b42a73c74ab5a.jpg?imageView2/2/w/120/format/jpg",
    "content": "人均多少[色色R]",
    "like_count": 0,
    "sub_comment_count": 2,
    "ip_location": "广东",
    "create_time": "2026-03-21T04:57:46.000Z",
    "create_time_unix": 1774069066000,
    "comment_type": 0,
    "sub_comments": [
        {
            "comment_id": "69be2c85000000000f01ce2a",
            "parent_comment_id": "69be254a000000000d03546b",
            "root_comment_id": "69be254a000000000d03546b",
            "target_comment": {
                "id": "69be254a000000000d03546b"
            },
            "is_reply": true,
            "user_id": "59f0d4cb11be10535ca0f042",
            "user_name": "莲藕精",
            "user_avatar": "https://sns-avatar-qc.xhscdn.com/avatar/5f6198d142651e000122f004.jpg?imageView2/2/w/120/format/jpg",
            "content": "也就七八十！！很不贵",
            "like_count": 0,
            "sub_comment_count": 0,
            "ip_location": "广东",
            "comment_type": 0,
            "create_time": "2026-03-21T05:28:37.000Z",
            "create_time_unix": 1774070917000
        }
    ]
}
```

### Tips for Best Results

- Use a fresh note link or share link copied from the Xiaohongshu app.
- A bare note id works when you already know the note.
- Start with 20 to 50 comments to check the dataset shape.
- Keep `include_replies` on when reply context matters.
- Xiaohongshu returns a sample of replies under each comment. The `sub_comment_count` field shows the full reply count.
- Comment counts and availability can change while a note is live.
- If a link is old or the note was deleted, use a current share link.
- Use a proxy for large scheduled runs if you see temporary rate limits.

### Integrations

- **Google Sheets** - analyze comments in a spreadsheet.
- **Webhooks** - notify another system when a run finishes.
- **Make or Zapier** - send new comments to a workflow.
- **Apify API** - run the Actor from your own application.
- **CSV, Excel, JSON, XML** - export the dataset in the format your team uses.

### Frequently Asked Questions

#### Do I need a Xiaohongshu login?

No. The Actor collects public comments without an account.

#### Can I export comments to CSV or Excel?

Yes. Apify datasets can be downloaded as CSV, Excel, JSON, XML, and other supported formats.

#### Can I collect replies?

Yes. Replies Xiaohongshu returns with a top-level comment are nested under `sub_comments`. Set `include_replies` to `false` if you only want top-level comments.

#### Why are some replies missing?

Xiaohongshu exposes a sample of replies with each comment. The `sub_comment_count` field shows the total number of replies for that comment.

#### Why does a note return no comments?

The note may be deleted, private, region restricted, have comments disabled, or have no comments yet. Try a current share link from the app.

#### Can I run this Actor on a schedule?

Yes. Create a schedule in Apify Console and choose how often the Actor should collect comments.

#### Can I use more than one note?

Run the Actor once per note. For multiple notes, use separate runs or a task per note.

#### Is this Actor suitable for non-technical users?

Yes. Paste a link, set a limit, and run. The dataset can be downloaded without writing code.

#### Is it legal to scrape Xiaohongshu comments?

Scraping public data can be legal, but you are responsible for complying with applicable laws, the website terms, and privacy rules. Do not use the data for harassment, doxxing, or other harmful purposes.

### Support

For issues, feature requests, or custom Actor work, use the Issues tab on the Actor page or contact the developer through Apify.

### Legal Notice

This Actor is designed for legitimate collection of publicly available comments. Users are responsible for how they store, process, and share the data, and for complying with applicable laws and Xiaohongshu terms.

# Actor input Schema

## `startUrl` (type: `string`):

A Xiaohongshu note link, discovery link, xhslink share link, share text containing a link, or a bare 24 character note id. Share links are resolved automatically.

## `results_wanted` (type: `integer`):

Maximum number of top-level comment rows to save. Embedded replies are included inside each row.

## `max_pages` (type: `integer`):

Maximum number of comment pages to request. Each page contains up to 20 top-level comments.

## `include_replies` (type: `boolean`):

Attach the replies Xiaohongshu returns with each top-level comment. Replies are nested under sub_comments.

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

Optional proxy configuration. The actor works without a proxy. Use residential proxies when repeated runs hit rate limits.

## Actor input object example

```json
{
  "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076",
  "results_wanted": 20,
  "max_pages": 10,
  "include_replies": true,
  "proxyConfiguration": {}
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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 = {
    "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076"
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/xiaohongshu-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 = { "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076" }

# Run the Actor and wait for it to finish
run = client.actor("shahidirfan/xiaohongshu-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 '{
  "startUrl": "https://www.xiaohongshu.com/explore/69bd1074000000001a035076"
}' |
apify call shahidirfan/xiaohongshu-comments-scraper --silent --output-dataset

```

## MCP server setup

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