# Xiaohongshu Search Scraper (`kuaima/xiaohongshu-search`) Actor

The Xiaohongshu Search Crawler is a web scraping tool developed on the Apify platform for collecting public search data from Xiaohongshu platform. This Actor supports keyword search, sorting methods, auto pagination collection, etc.

小红书用于采集小红书平台的公开搜索数据。该Actor支持关键词搜索、排序方式选择、自动翻页采集等功能。

- **URL**: https://apify.com/kuaima/xiaohongshu-search.md
- **Developed by:** [kuai ma](https://apify.com/kuaima) (community)
- **Categories:** E-commerce, Social media
- **Stats:** 371 total users, 3 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: 5.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 Search Crawler

![Logo](logo.png)

### 简介 / Introduction

小红书用于采集小红书平台的公开搜索数据。该Actor支持关键词搜索、排序方式选择、自动翻页采集等功能。

The Xiaohongshu Search Crawler is a web scraping tool developed on the Apify platform for collecting public search data from Xiaohongshu platform. This Actor supports keyword search, sorting methods, auto pagination collection, etc.

### 功能特性 / Features

- 支持关键词搜索

- 可按最新/最热排序结果

- 自动处理分

- Supports keyword search

- Sort results by latest/hottest

- Automatic pagination handling

### 输入配置 / Input Configuration

```json
{
    "categories": "全部",
    "search_key": "天津",
    "scrape_detail": true,
    "download_image": false,
    "cookie_val": "",
    "filter": "最新",
    "maxItems": 5
}
```

### 输出示例 / Output Sample

```json
[
    {
        "cate": " 全部",
        "date": "2025-03-07",
        "title": "2025年在天津哪里买房更宜居？",
        "author": "航姐在天津卖房",
        "author_avatar": "https://sns-avatar-qc.xhscdn.com/avatar/5ed1ec31dc54900001180abd.jpg",
        "like_count": "10",
        "href": "https://www.xiaohongshu.com/explore/67c8169a0000000029026978",
        "desec": "",
        "collect_count": "",
        "chat_count": "",
        "tags": [],
        "noteType": ""
    },
    ....
]
```

### 运行说明 / Usage

1. 在Apify控制台配置输入参数

2. 启动Actor运行

3. 在Dataset中查看采集结果

4. 支持JSON/CSV/XLSX格式导出

5. Configure input parameters in Apify console

6. Start Actor execution

7. View results in Dataset

8. Export in JSON/CSV/XLSX formats

### 注意事项 / Notes

- 请遵守小红书用户协议和当地法律法规

- 建议合理设置采集频率

- Comply with Xiaohongshu's terms of service and local regulations

- Set reasonable crawling frequency

- Use Apify Proxy for IP rotation

# Actor input Schema

## `categories` (type: `string`):

搜索类别：全部，视频，图文。Search categories: All, Video, image

## `search_key` (type: `string`):

search key 搜索关键字

## `maxItems` (type: `integer`):

maxItems 最大抓取数量

## `cookie_val` (type: `string`):

Must include cookies. 必须加入cookies。

## `scrape_detail` (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. 是否下载图片。

## `filter` (type: `string`):

filter  过滤条件

## Actor input object example

```json
{
  "categories": "全部",
  "search_key": "",
  "maxItems": 10,
  "scrape_detail": false,
  "download_image": false,
  "filter": "综合"
}
```

# 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-search").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-search").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-search --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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