# XiaoHongShu Profile Scraper (`kuaima/xiaohongshu-profile`) Actor

本工具可以处理小红书用户页数据及其发表的文章详情页数据。[小红书](https://www.xiaohongshu.com/) is a famous social e-commerce platform that combines user-generated content with online shopping, catering to the needs of young Chinese consumers. This scraper can get data from xiaohongshu user profile and detail pages.

- **URL**: https://apify.com/kuaima/xiaohongshu-profile.md
- **Developed by:** [kuai ma](https://apify.com/kuaima) (community)
- **Categories:** E-commerce, Social media
- **Stats:** 306 total users, 1 monthly users, 100.0% runs succeeded, 9 bookmarks
- **User rating**: 2.00 out of 5 stars

## Pricing

$20.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

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

## XiaoHongShu Profile Scraper / 小红书个人资料爬虫

This scraper can get data from xiaohongshu user profile. / 该爬虫可以从小红书用户个人资料页面获取数据。

### Features / 功能

- Get useful data from user profile page like https://www.xiaohongshu.com/user/profile/577285526a6a697c22af03fe / 从用户个人资料页面获取有用数据，例如：https://www.xiaohongshu.com/user/profile/577285526a6a697c22af03fe
- Get useful data from user post detail page / 从用户帖子详情页面获取有用数据
- Can filter data by date-range / 可按日期范围过滤数据

### Usage Tips / 使用技巧

- To get cover images, set `download_image` parameter to true. Images will be saved as `<date>_cover_<post_id>.webp` / 要获取封面图片，请将 `download_image` 参数设置为 true。图片将保存为 `<date>_cover_<post_id>.webp`
- For tags, date and location information, enable `scrape_detail_page` and provide `cookies` (JSON format) / 要获取标签、日期和位置信息，请启用 `scrape_detail_page` 并提供 `cookies`（JSON 格式）

#### Exporting Cookies / 导出 Cookie

##### Using Browser Developer Tools / 使用浏览器开发者工具

1. Open browser and navigate to target website / 打开浏览器并导航到目标网站
2. Access developer tools (F12 or right-click → Inspect) / 访问开发者工具（F12 或右键单击 → 检查）
3. Go to Application tab → Storage → Cookies / 转到应用程序选项卡 → 存储 → Cookie
4. Select 'web\_session' → right-click value → export or copy manually / 选择web\_session → 右键单击 值→ 手动复制

##### Recommended Tools / 推荐工具

- EditThisCookie: Browser extension for easy cookie export / 用于轻松导出 Cookie 的浏览器扩展
- Cookie-Editor: Another versatile cookie export tool / 另一个多功能 Cookie 导出工具

### Example Configuration / 示例配置

```json
{
  "scrape_detail_page": true,
  "cookie_val":"...",
}
```

### Data Examples / 数据示例

#### Profile Page / 个人资料页面

![page screenshot](https://cdn.jsdelivr.net/gh/rwb-apify/resources/xiaohongshu-profile/page.png)

#### Post Detail Page / 帖子详情页面

![page screenshot](https://cdn.jsdelivr.net/gh/rwb-apify/resources/xiaohongshu-profile/page_detail.png)

#### Scraped Data / 抓取的数据

![data screenshot](https://cdn.jsdelivr.net/gh/rwb-apify/resources/xiaohongshu-profile/xiaohongshu_profile_data_1.png)

#### Data Format / 数据格式

````javascript
[
  {
    "id": "655bfa160000000032009e1a",
    "cover": "http://sns-webpic-qc.xhscdn.com/202311212112/629ecb62902a91998666e62eee403d23/1040g00830rnggn8q2e004btv5lp801r86pu2s2o!nc_n_webp_mw_1format/jpg",
    "title": "粉条豆腐包",
    "url": "https://www.xiaohongshu.com/user/profile/5bfb3280e7444b0001520768/655bfa160000000032009e1a",
    "num_count": "9",
    "top_tag": false,
    "author": "小楼（美食日记）",
    "avatar": "https://sns-avatar-qc.xhscdn.com/avatar/60a5f35a957c7c083b9b97aa.jpg?imageView2/2/w/540/format/webp|imageMogr2/strip2",
    "author_url": "https://www.xiaohongshu.com/user/profile/5bfb3280e7444b0001520768",
    "desc": "冬天怎么能少得了一锅香喷喷的粉条豆腐包呢，你也赶紧去试试吧",
    "tags": [
      "豆腐粉条包子话题可以点击搜索啦~",
      "粉条豆腐包",
      "豆腐包子"
    ],
    "date": "2023-11-21",
    "location": "四川",
    "video": "https://sns-video-bd.xhscdn.com/stream/110/258/01e55bf9d67fb0a1010370038bef498eda_258.mp4"
  }
]

# Actor input Schema

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

list of user profile. To avoid anti-crawl, it's better crawl less than 10 profile once. The input format is like https://www.xiaohongshu.com/user/profile/56efb383aed75861abe37210. 小红书用户的链接，为避免反爬虫每次不要超过10个。支持的格式是类似https://www.xiaohongshu.com/user/profile/56efb383aed75861abe37210
## `date_range` (type: `integer`):

No description
## `scrape_detail_page` (type: `boolean`):

If enable, the scaper will scape detail page. This can get more information but cost more time and resource. Use it when you really need it. 是否抓取小红书用的内容详情页信息，用户内容多的话，可能会很消耗资源或被反制。
## `download_image` (type: `boolean`):

If enable, the scaper will download cover page. 是否下载图片。
## `cookie_val` (type: `string`):

If enable Scrape detail page,Must include cookies. 如果抓取详细内容，必须加入cookies。

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.xiaohongshu.com/user/profile/5d5a56c10000000001000813"
    }
  ],
  "date_range": 0,
  "scrape_detail_page": false,
  "download_image": false
}
````

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("kuaima/xiaohongshu-profile").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("kuaima/xiaohongshu-profile").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 '{}' |
apify call kuaima/xiaohongshu-profile --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/vxyuh2tdX7S299DP9/builds/rOBYJaYIfLVkHpPmM/openapi.json
