Skip to content
Back to search

openclaw-xhs

🔥 让 OpenClaw 读懂你的小红书 — MCP 集成 + 热点跟踪 + 个人记忆库导出

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zhjiang22--openclaw-xhs/badge.svg)](/listings/zhjiang22--openclaw-xhs)

HTML

<a href="/listings/zhjiang22--openclaw-xhs"><img src="/api/listings/zhjiang22--openclaw-xhs/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Install xiaohongshu-mcp

Download from [GitHub Releases](https://github.com/xpzouying/xiaohongshu-mcp/releases):

# Linux x64
wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-linux-amd64.tar.gz
wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-linux-amd64.tar.gz

# macOS ARM
wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-darwin-arm64.tar.gz
wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-darwin-arm64.tar.gz

Install:

mkdir -p ~/.local/bin
tar -xzf xiaohongshu-mcp-*.tar.gz -C ~/.local/bin/
tar -xzf xiaohongshu-login-*.tar.gz -C ~/.local/bin/

cd ~/.local/bin
mv xiaohongshu-mcp-* xiaohongshu-mcp
mv xiaohongshu-login-* xiaohongshu-login
chmod +x xiaohongshu-mcp xiaohongshu-login

2. Install This Toolkit

# Clone to OpenClaw workspace
git clone https://github.com/zhjiang22/openclaw-xhs.git
cp -r openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu

# Or use symlink
ln -s /path/to/openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu

# Verify installation
cd ~/.openclaw/workspace/skills/xiaohongshu/scripts
./install-check.sh

3. Login (Get Cookies)

**Option A: Desktop Environment**

./login.sh  # Opens browser, scan QR code with Xiaohongshu app

**Option B: Headless Server**

Get cookies on your local machine, then copy to server:

# On local machine with GUI
./xiaohongshu-login
# Cookies saved to /tmp/cookies.json

# Copy to server
scp /tmp/cookies.json user@server:~/.xiaohongshu/cookies.json

4. Start Service

./start-mcp.sh              # Headless mode
./start-mcp.sh --headless=false  # Show browser (debug)

Service runs at `http://localhost:18060/mcp`.

Server Deployment (Headless Linux)

On servers without a desktop environment, the underlying browser requires a virtual display. `start-mcp.sh` **auto-detects** the environment — if no display is found, it starts Xvfb automatically. Just install it first:

# Debian/Ubuntu
sudo apt-get install -y xvfb

# CentOS/RHEL
sudo yum install -y xorg-x11-server-Xvfb

No extra configuration needed. The script handles: - Detecting the `DISPLAY` environment variable - Auto-starting `Xvfb :99` when no display is available - Cleaning up Xvfb when `stop-mcp.sh` is called

> **Note**: Without Xvfb, login and search will fail on headless servers. See [Issue #3](https://github.com/zhjiang22/openclaw-xhs/issues/3).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 202 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: xiaohongshu
  3. description: |
  4. 小红书(RedNote)内容工具。使用场景:
  5. - 搜索小红书笔记并获取详情
  6. - 获取首页推荐列表
  7. - 获取帖子详情(正文、图片、互动数据、评论)
  8. - 发表评论 / 回复评论
  9. - 获取用户主页和笔记列表
  10. - 点赞、收藏帖子
  11. - 发布图文或视频笔记
  12. - 热点话题跟踪与分析报告
  13. - 帖子导出为长图
  14. 触发词示例:
  15. - "搜一下小红书上的XX"
  16. - "跟踪一下小红书上的XX热点"
  17. - "分析小红书上关于XX的讨论"
  18. - "小红书XX话题报告"
  19. - "生成XX的小红书舆情报告"
  20. ---
  21. # 小红书 MCP Skill
  22. 基于 [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) 封装的 shell 脚本工具集。
  23. ## 前置条件
  24. ```bash
  25. cd scripts/
  26. ./install-check.sh # 检查依赖(xiaohongshu-mcp、jq、python3)
  27. ./start-mcp.sh # 启动 MCP 服务(默认端口 18060)
  28. ./status.sh # 确认已登录
  29. ```
  30. 未登录时需扫码:`mcp-call.sh get_login_qrcode` 获取二维码,用小红书 App 扫码。
  31. 服务端口可通过 `MCP_URL` 环境变量覆盖(默认 `http://localhost:18060/mcp`)。
  32. ## 核心数据流
  33. **重要:** 大多数操作需要 `feed_id` + `xsec_token` 配对。这两个值从搜索/推荐/用户主页结果中获取,**不可自行构造**。
  34. ```
  35. search_feeds / list_feeds / user_profile
  36. │
  37. ▼
  38. 返回 feeds 数组,每个 feed 包含:
  39. ├── id → 用作 feed_id
  40. ├── xsecToken → 用作 xsec_token
  41. └── noteCard → 标题、作者、封面、互动数据
  42. │
  43. ▼
  44. get_feed_detail(feed_id, xsec_token)
  45. │
  46. ▼
  47. 返回完整笔记: 正文、图片列表、评论列表
  48. 评论中包含 comment_id、user_id(用于回复评论)
  49. ```
  50. ## 脚本参考
  51. | 脚本 | 用途 | 参数 |
  52. |------|------|------|
  53. | `search.sh <关键词>` | 搜索笔记 | 关键词 |
  54. | `recommend.sh` | 首页推荐 | 无 |
  55. | `post-detail.sh <feed_id> <xsec_token>` | 帖子详情+评论 | 从搜索结果获取 |
  56. | `comment.sh <feed_id> <xsec_token> <内容>` | 发表评论 | 从搜索结果获取 |
  57. | `user-profile.sh <user_id> <xsec_token>` | 用户主页+笔记 | 从搜索结果获取 |
  58. | `track-topic.sh <话题> [选项]` | 热点分析报告 | `--limit N` `--output file` `--feishu` |
  59. | `export-long-image.sh` | 帖子导出长图 | `--posts-file json -o output.jpg` |
  60. | `mcp-call.sh <tool> [json_args]` | 通用 MCP 调用 | 见下方工具表 |
  61. | `start-mcp.sh` | 启动服务 | `--headless=false` `--port=N` |
  62. | `stop-mcp.sh` | 停止服务 | 无 |
  63. | `status.sh` | 检查登录 | 无 |
  64. | `install-check.sh` | 检查依赖 | 无 |
  65. ## MCP 工具详细参数
  66. ### search_feeds — 搜索笔记
  67. ```json
  68. {"keyword": "咖啡", "filters": {"sort_by": "最新", "note_type": "图文", "publish_time": "一周内"}}
  69. ```
  70. filters 可选字段:
  71. - `sort_by`: 综合 | 最新 | 最多点赞 | 最多评论 | 最多收藏
  72. - `note_type`: 不限 | 视频 | 图文
  73. - `publish_time`: 不限 | 一天内 | 一周内 | 半年内
  74. - `search_scope`: 不限 | 已看过 | 未看过 | 已关注
  75. - `location`: 不限 | 同城 | 附近
  76. ### get_feed_detail — 帖子详情
  77. ```json
  78. {"feed_id": "...", "xsec_token": "...", "load_all_comments": true, "limit": 20}
  79. ```
  80. - `load_all_comments`: false(默认) 返回前10条,true 滚动加载更多
  81. - `limit`: 加载评论上限(仅 load_all_comments=true 时生效),默认 20
  82. - `click_more_replies`: 是否展开二级回复,默认 false
  83. - `reply_limit`: 跳过回复数超过此值的评论,默认 10
  84. - `scroll_speed`: slow | normal | fast
  85. ### post_comment_to_feed — 发表评论
  86. ```json
  87. {"feed_id": "...", "xsec_token": "...", "content": "写得真好!"}
  88. ```
  89. ### reply_comment_in_feed — 回复评论
  90. ```json
  91. {"feed_id": "...", "xsec_token": "...", "content": "谢谢!", "comment_id": "...", "user_id": "..."}
  92. ```
  93. `comment_id` 和 `user_id` 从 get_feed_detail 返回的评论列表中获取。
  94. ### user_profile — 用户主页
  95. ```json
  96. {"user_id": "...", "xsec_token": "..."}
  97. ```
  98. `user_id` 从 feed 的 `noteCard.user.userId` 获取,`xsec_token` 使用该 feed 的 `xsecToken`。
  99. ### like_feed — 点赞/取消
  100. ```json
  101. {"feed_id": "...", "xsec_token": "..."}
  102. {"feed_id": "...", "xsec_token": "...", "unlike": true}
  103. ```
  104. ### favorite_feed — 收藏/取消
  105. ```json
  106. {"feed_id": "...", "xsec_token": "..."}
  107. {"feed_id": "...", "xsec_token": "...", "unfavorite": true}
  108. ```
  109. ### publish_content — 发布图文
  110. ```json
  111. {"title": "标题(≤20字)", "content": "正文(≤1000字)", "images": ["/path/to/img.jpg"], "tags": ["美食","旅行"]}
  112. ```
  113. - `images`: 至少1张,支持本地路径或 HTTP URL
  114. - `tags`: 可选,话题标签
  115. - `schedule_at`: 可选,定时发布(ISO8601,1小时~14天内)
  116. ### publish_with_video — 发布视频
  117. ```json
  118. {"title": "标题", "content": "正文", "video": "/path/to/video.mp4"}
  119. ```
  120. ### 其他工具
  121. | 工具 | 参数 | 说明 |
  122. |------|------|------|
  123. | `check_login_status` | 无 | 检查登录状态 |
  124. | `list_feeds` | 无 | 获取首页推荐 |
  125. | `get_login_qrcode` | 无 | 获取登录二维码(Base64 PNG) |
  126. | `delete_cookies` | 无 | 删除 cookies,重置登录 |
  127. ## 热点跟踪
  128. 自动搜索 → 拉取详情 → 生成 Markdown 报告。
  129. ```bash
  130. ./track-topic.sh "DeepSeek" --limit 5
  131. ./track-topic.sh "春节旅游" --limit 10 --output report.md
  132. ./track-topic.sh "iPhone 16" --limit 5 --feishu # 导出飞书
  133. ```
  134. 报告包含:概览统计、热帖详情(正文+热评)、评论关键词、趋势分析。
  135. ## 长图导出
  136. 将帖子导出为白底黑字的 JPG 长图。
  137. ```bash
  138. ./export-long-image.sh --posts-file posts.json -o output.jpg
  139. ```
  140. posts.json 格式:
  141. ```json
  142. [{
  143. "title": "标题", "author": "作者", "stats": "1.3万赞",
  144. "desc": "正文摘要", "images": ["https://..."],
  145. "per_image_text": {"1": "第2张图的说明"}
  146. }]
  147. ```
  148. 依赖:Python 3.10+、Pillow。
  149. ## 注意事项
  150. - Cookies 有效期约 30 天,过期需重新扫码
  151. - 首次启动会下载 headless 浏览器(~150MB)
  152. - 同一账号避免多客户端同时操作
  153. - 发布限制:标题≤20字符,正文≤1000字符,日发布≤50条
  154. - Linux 服务器无桌面环境需安装 xvfb(`apt-get install xvfb`,脚本自动管理)
README.md · README · 315 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # XHS AI Toolkit
  2. <p align="center">
  3. <b>Make AI understand your Xiaohongshu (RedNote)</b>
  4. </p>
  5. <p align="center">
  6. <a href="README_CN.md">简体中文</a> | English
  7. </p>
  8. <p align="center">
  9. <img alt="License" src="https://img.shields.io/badge/license-MIT-blue.svg">
  10. <img alt="Platform" src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS-lightgrey.svg">
  11. <img alt="Python" src="https://img.shields.io/badge/python-3.10+-green.svg">
  12. <img alt="MCP" src="https://img.shields.io/badge/MCP-compatible-purple.svg">
  13. </p>
  14. ---
  15. AI-powered toolkit for **Xiaohongshu (小红书 / RedNote)** that turns your favorite posts into AI memory.
  16. - **MCP Integration** — Search, browse, comment via AI assistants
  17. - **Trend Tracking** — Auto-generate topic reports with engagement analytics
  18. - **Memory Export** — Convert your liked/saved posts into AI-searchable knowledge base
  19. Built on [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp) and [XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader).
  20. ## Features
  21. | Feature | Description |
  22. |---------|-------------|
  23. | Search | Search posts by keywords |
  24. | Feed | Get homepage recommendations |
  25. | Post Details | Fetch post content, comments, engagement stats |
  26. | Comment | Post comments to notes |
  27. | User Profile | Get user info and their posts |
  28. | Trend Tracking | Auto-generate topic analysis reports |
  29. | Long Image Export | Export posts as annotated JPG long images |
  30. | Memory Export | Export liked/saved posts as Markdown for AI memory |
  31. ## Quick Start
  32. ### 1. Install xiaohongshu-mcp
  33. Download from [GitHub Releases](https://github.com/xpzouying/xiaohongshu-mcp/releases):
  34. ```bash
  35. # Linux x64
  36. wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-linux-amd64.tar.gz
  37. wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-linux-amd64.tar.gz
  38. # macOS ARM
  39. wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-mcp-darwin-arm64.tar.gz
  40. wget https://github.com/xpzouying/xiaohongshu-mcp/releases/latest/download/xiaohongshu-login-darwin-arm64.tar.gz
  41. ```
  42. Install:
  43. ```bash
  44. mkdir -p ~/.local/bin
  45. tar -xzf xiaohongshu-mcp-*.tar.gz -C ~/.local/bin/
  46. tar -xzf xiaohongshu-login-*.tar.gz -C ~/.local/bin/
  47. cd ~/.local/bin
  48. mv xiaohongshu-mcp-* xiaohongshu-mcp
  49. mv xiaohongshu-login-* xiaohongshu-login
  50. chmod +x xiaohongshu-mcp xiaohongshu-login
  51. ```
  52. ### 2. Install This Toolkit
  53. ```bash
  54. # Clone to OpenClaw workspace
  55. git clone https://github.com/zhjiang22/openclaw-xhs.git
  56. cp -r openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu
  57. # Or use symlink
  58. ln -s /path/to/openclaw-xhs ~/.openclaw/workspace/skills/xiaohongshu
  59. # Verify installation
  60. cd ~/.openclaw/workspace/skills/xiaohongshu/scripts
  61. ./install-check.sh
  62. ```
  63. ### 3. Login (Get Cookies)
  64. **Option A: Desktop Environment**
  65. ```bash
  66. ./login.sh # Opens browser, scan QR code with Xiaohongshu app
  67. ```
  68. **Option B: Headless Server**
  69. Get cookies on your local machine, then copy to server:
  70. ```bash
  71. # On local machine with GUI
  72. ./xiaohongshu-login
  73. # Cookies saved to /tmp/cookies.json
  74. # Copy to server
  75. scp /tmp/cookies.json user@server:~/.xiaohongshu/cookies.json
  76. ```
  77. ### 4. Start Service
  78. ```bash
  79. ./start-mcp.sh # Headless mode
  80. ./start-mcp.sh --headless=false # Show browser (debug)
  81. ```
  82. Service runs at `http://localhost:18060/mcp`.
  83. #### Server Deployment (Headless Linux)
  84. On servers without a desktop environment, the underlying browser requires a virtual display.
  85. `start-mcp.sh` **auto-detects** the environment — if no display is found, it starts Xvfb automatically. Just install it first:
  86. ```bash
  87. # Debian/Ubuntu
  88. sudo apt-get install -y xvfb
  89. # CentOS/RHEL
  90. sudo yum install -y xorg-x11-server-Xvfb
  91. ```
  92. No extra configuration needed. The script handles:
  93. - Detecting the `DISPLAY` environment variable
  94. - Auto-starting `Xvfb :99` when no display is available
  95. - Cleaning up Xvfb when `stop-mcp.sh` is called
  96. > **Note**: Without Xvfb, login and search will fail on headless servers. See [Issue #3](https://github.com/zhjiang22/openclaw-xhs/issues/3).
  97. ## Usage
  98. ### Basic Commands
  99. ```bash
  100. ./status.sh # Check login status
  101. ./search.sh "coffee" # Search posts
  102. ./recommend.sh # Get recommendations
  103. ./post-detail.sh <id> <token> # Get post details
  104. ./comment.sh <id> <token> "Great post!" # Comment
  105. ./user-profile.sh <user_id> <xsec_token> # Get user profile
  106. ```
  107. ### Trend Tracking
  108. Auto-search trending posts and generate analysis reports:
  109. ```bash
  110. ./track-topic.sh "AI" --limit 10
  111. ./track-topic.sh "travel" --limit 5 --output report.md
  112. ./track-topic.sh "iPhone" --limit 5 --feishu # Export to Feishu
  113. ```
  114. ### MCP Tools
  115. | Tool | Description |
  116. |------|-------------|
  117. | `check_login_status` | Check login status |
  118. | `search_feeds` | Search posts |
  119. | `list_feeds` | Get homepage feed |
  120. | `get_feed_detail` | Get post details & comments |
  121. | `post_comment_to_feed` | Post comment |
  122. | `user_profile` | Get user profile |
  123. | `like_feed` | Like/unlike post |
  124. | `favorite_feed` | Save/unsave post |
  125. | `publish_content` | Publish image post |
  126. | `publish_with_video` | Publish video post |
  127. ### Long Image Export
  128. Export posts as annotated JPG long images (white background, black text):
  129. ```bash
  130. # Prepare posts.json
  131. cat > posts.json << 'EOF'
  132. [
  133. {
  134. "title": "Post title",
  135. "author": "Author",
  136. "stats": "13k likes 100 saves",
  137. "desc": "Post summary",
  138. "images": ["https://...webp"],
  139. "per_image_text": {"1": "Caption for 2nd image"}
  140. }
  141. ]
  142. EOF
  143. ./export-long-image.sh --posts-file posts.json -o output.jpg
  144. ```
  145. Requires: Python 3.10+, Pillow (`pip install Pillow`)
  146. ## Memory Export (Turn Likes into AI Memory)
  147. Export your liked/saved posts as a searchable knowledge base for AI assistants.
  148. ### 1. Install XHS-Downloader
  149. ```bash
  150. git clone https://github.com/JoeanAmier/XHS-Downloader.git
  151. cd XHS-Downloader
  152. pip install -r requirements.txt
  153. ```
  154. ### 2. Extract Post Links (Tampermonkey Script)
  155. 1. Install [Tampermonkey](https://www.tampermonkey.net/)
  156. 2. Install [XHS-Downloader UserScript](https://raw.githubusercontent.com/JoeanAmier/XHS-Downloader/refs/heads/master/static/XHS-Downloader.js)
  157. 3. Go to Xiaohongshu web → Profile → Liked/Saved
  158. 4. Click Tampermonkey menu → "Extract liked posts" or "Extract saved posts"
  159. 5. Links auto-copied to clipboard
  160. 6. Paste into `links.md`
  161. ### 3. Download & Export
  162. ```bash
  163. # Copy helper scripts
  164. cp tools/xhs-downloader/*.py /path/to/XHS-Downloader/
  165. # Download posts
  166. cd /path/to/XHS-Downloader
  167. python batch_download.py links.md
  168. # Export to workspace
  169. python export_to_workspace.py
  170. # Output: ~/.openclaw/workspace/xhs-memory/
  171. ```
  172. ### 4. Configure OpenClaw Memory Search
  173. Edit `~/.openclaw/openclaw.json`:
  174. ```json
  175. {
  176. "memorySearch": {
  177. "extraPaths": [
  178. "~/.openclaw/workspace/xhs-memory"
  179. ]
  180. }
  181. }
  182. ```
  183. Now your AI assistant can search your Xiaohongshu favorites!
  184. ## Project Structure
  185. ```
  186. openclaw-xhs/
  187. ├── README.md # English docs
  188. ├── README_CN.md # Chinese docs
  189. ├── LICENSE
  190. ├── SKILL.md # Skill manifest
  191. ├── scripts/ # MCP wrapper scripts
  192. │ ├── install-check.sh
  193. │ ├── start-mcp.sh
  194. │ ├── stop-mcp.sh
  195. │ ├── login.sh
  196. │ ├── mcp-call.sh
  197. │ ├── status.sh
  198. │ ├── search.sh
  199. │ ├── recommend.sh
  200. │ ├── post-detail.sh
  201. │ ├── comment.sh
  202. │ ├── user-profile.sh
  203. │ ├── track-topic.sh
  204. │ ├── track-topic.py
  205. │ ├── export-long-image.sh
  206. │ └── export-long-image.py
  207. └── tools/
  208. └── xhs-downloader/ # Memory export tools
  209. ├── README.md
  210. ├── batch_download.py
  211. ├── export_memory.py
  212. └── export_to_workspace.py
  213. ```
  214. ## Security
  215. This project implements the following security measures:
  216. - **Cookie protection**: Cookie files are copied with `600` permissions (owner-only read/write)
  217. - **Injection prevention**: All shell scripts use `jq` to build JSON payloads instead of string interpolation, preventing shell injection
  218. - **Tool name validation**: MCP tool names are restricted to alphanumeric characters and underscores
  219. - **Path validation**: Cross-skill script calls validate that target paths are within allowed directories
  220. - **Third-party content**: Content fetched from Xiaohongshu is user-generated; exercise appropriate caution
  221. ## Disclaimer
  222. This project is a **wrapper layer** for [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp).
  223. - Does NOT contain xiaohongshu-mcp source code
  224. - Users must download xiaohongshu-mcp binaries separately
  225. - Scripts communicate via HTTP protocol only
  226. ## Acknowledgments
  227. - [@xpzouying](https://github.com/xpzouying) — [xiaohongshu-mcp](https://github.com/xpzouying/xiaohongshu-mcp)
  228. - [@JoeanAmier](https://github.com/JoeanAmier) — [XHS-Downloader](https://github.com/JoeanAmier/XHS-Downloader) (GPL-3.0)
  229. ## License
  230. MIT License (wrapper scripts only)
  231. **Note:** xiaohongshu-mcp has no declared license. Please respect the author's terms.
  232. ---
  233. <p align="center">
  234. <b>If this project helps you, please give it a ⭐!</b>
  235. </p>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.