← 返回 Skills 市场
besty0121

Xiaohongshu Browser

作者 besty0121 · GitHub ↗ · v1.2.1 · MIT-0
cross-platform ✓ 安全检测通过
199
总下载
1
收藏
1
当前安装
4
版本数
在 OpenClaw 中安装
/install xiaohongshu-browser
功能描述
Browse Xiaohongshu (小红书) and take screenshots of posts. Supports keyword search, post modal screenshots, and returns post links. Requires prior manual login.
使用说明 (SKILL.md)

Xiaohongshu Browser / 小红书浏览器

用 Playwright 自动化浏览小红书,搜索关键词并截图帖子弹窗预览。

Automate Xiaohongshu browsing — search keywords and screenshot post modal previews.

前置要求 / Prerequisites

Python 3.x + Playwright

pip install playwright
playwright install chromium

使用步骤

第一步:首次登录(只需要做一次)

  1. 运行登录脚本,会弹出浏览器窗口:
python \x3Cskill_dir>/scripts/xhs_open.py
  1. 在弹出的浏览器里手动登录小红书(扫码或账号密码都行)

  2. 登录成功后,创建一个控制文件来保存登录状态:

# Windows (PowerShell):
Set-Content "$env:USERPROFILE\.openclaw\.close_browser" "CLOSE"

# Windows (CMD):
echo CLOSE > %USERPROFILE%\.openclaw\.close_browser

# Linux / macOS:
echo CLOSE > ~/.openclaw/.close_browser
  1. 看到终端输出 AUTH_SAVED 就说明登录状态保存好了

💡 登录状态保存在 ~/.openclaw/xhs_data,以后搜索时会自动使用,不需要重复登录。

第二步:搜索并截图

python \x3Cskill_dir>/scripts/xhs_search.py "关键词" 数量

参数说明:

  • 第一个参数:搜索关键词(默认:御姐
  • 第二个参数:截图几个帖子(默认:5

示例:

# 搜索"美食",截图前3个帖子
python \x3Cskill_dir>/scripts/xhs_search.py "美食" 3

# 搜索"穿搭",截图前10个
python \x3Cskill_dir>/scripts/xhs_search.py "穿搭" 10

# 不传参数,用默认值
python \x3Cskill_dir>/scripts/xhs_search.py

输出结果

截图保存在 \x3Cskill_dir>/output/ 目录,文件名格式:post_序号_时间戳.png

每张截图包含帖子弹窗预览(图文详情)。

常见问题

需要重新登录?

小红书的登录会过期,如果搜索时遇到登录弹窗,需要重新登录:

# 1. 删除旧的登录数据
# Windows:
Remove-Item -Recurse -Force "$env:USERPROFILE\.openclaw\xhs_data"
# Linux / macOS:
rm -rf ~/.openclaw/xhs_data

# 2. 重新运行登录脚本
python \x3Cskill_dir>/scripts/xhs_open.py

搜索没结果?

  • 小红书可能会限制频繁访问,等几分钟再试
  • 关键词不要太长,2-6个字最佳
  • 不要带 # 号,直接搜关键词

目录结构

xiaohongshu-browser/
├── SKILL.md              # 本说明文件
├── scripts/
│   ├── xhs_open.py       # 登录脚本(首次使用)
│   └── xhs_search.py     # 搜索+截图脚本
└── output/               # 截图输出目录

注意事项

  • 使用无头浏览器(headless),不会弹出窗口
  • 操作间有随机延迟,降低被检测风险
  • 频繁使用可能触发小红书的反爬机制
  • 帖子链接需要 xsec_token 才能直接访问(搜索结果中已包含)
安全使用建议
This skill appears to do what it says: it automates a browser to let you manually log in once and then perform headless searches and screenshots. Before installing/running: 1) manually install Playwright and review the installation commands in SKILL.md; 2) understand that the skill saves login/session data under ~/.openclaw (xhs_data and xhs_auth.json) — anyone with access to those files could reuse the session, so don't run on an untrusted or shared machine; 3) note the documentation mismatch: xhs_open.py opens a visible browser for manual login (not headless), while xhs_search.py runs headless; follow the login step as documented; 4) the tool may trigger site anti-bot protections (the script includes retry waits), and scraping may violate Xiaohongshu terms — proceed accordingly. If you need the skill to avoid persistent login state, do not permit it to write ~/.openclaw or periodically delete the saved auth files.
功能分析
Type: OpenClaw Skill Name: xiaohongshu-browser Version: 1.2.1 The xiaohongshu-browser skill automates searching and screenshotting posts on Xiaohongshu using Playwright. It handles session persistence by storing browser data locally in `~/.openclaw/xhs_data` and includes logic to manage IP blocks and UI popups. The code and instructions (SKILL.md, xhs_open.py, xhs_search.py) are consistent with the stated purpose and show no signs of malicious intent, unauthorized data exfiltration, or prompt injection.
能力评估
Purpose & Capability
Name/description (browse Xiaohongshu, search, screenshot) match the provided Python scripts which use Playwright to open the site, persist login state under ~/.openclaw/xhs_data, perform searches, click posts, and take screenshots. Required binary is only python, which is appropriate.
Instruction Scope
SKILL.md instructions align with the scripts' behavior (manual login via xhs_open.py, then automated search via xhs_search.py). Minor inconsistencies: SKILL.md's '注意事项' states '使用无头浏览器(headless),不会弹出窗口', but xhs_open.py launches a visible browser (headless=False) for manual login while xhs_search.py runs headless. SKILL.md mentions xsec_token for direct post access but the scripts do not extract or transmit tokens. Overall the instructions do not ask the agent to read unrelated system files or exfiltrate data to external endpoints.
Install Mechanism
No automated install spec included; SKILL.md instructs the user to pip install playwright and run 'playwright install chromium'. This is a standard, user-run setup and no arbitrary remote archives or installers are pulled by the skill itself.
Credentials
The skill requests no environment variables or external credentials. It writes and reads state under the user's HOME (~/.openclaw) including storage_state (xhs_auth.json) and a user-data directory (xhs_data) which will contain cookies/session data — this is expected for persistent logins but is sensitive (can be used to access the account). The amount of access is proportionate to the task but users should be aware of privacy risks of saved web auth state.
Persistence & Privilege
The skill does not request 'always: true' and is user-invocable only. It stores its own files under ~/.openclaw and does not modify other skills or system-wide agent settings. Autonomous invocation remains enabled by default, but that is platform normal behavior and not abused here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install xiaohongshu-browser
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /xiaohongshu-browser 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.1
修复IP风控问题,增加重试机制和随机延时
v1.2.0
- Expanded documentation with full bilingual instructions (Chinese and English). - Added detailed step-by-step login and search usage guides. - Included troubleshooting for common issues and re-login procedures. - Described directory structure and clarified file output formats. - Enhanced notes on anti-bot precautions and required environment setup.
v1.1.0
- Removed unused scripts and cached metadata files, simplifying the codebase. - Updated setup instructions in SKILL.md: removed `playwright-stealth` requirement and adjusted auth profile details. - Clarified manual login steps and revised environment variable usage in documentation.
v1.0.0
Xiaohongshu browser skill initial release. - Browse Xiaohongshu (小红书) and take screenshots of post modals. - Supports keyword-based search and returns post links with xsec_token. - Requires manual login for authentication (persistent session supported). - Outputs screenshots with images and descriptions, saved locally. - Includes setup, login, and usage instructions for first-time users.
元数据
Slug xiaohongshu-browser
版本 1.2.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 4
常见问题

Xiaohongshu Browser 是什么?

Browse Xiaohongshu (小红书) and take screenshots of posts. Supports keyword search, post modal screenshots, and returns post links. Requires prior manual login. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 199 次。

如何安装 Xiaohongshu Browser?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install xiaohongshu-browser」即可一键安装,无需额外配置。

Xiaohongshu Browser 是免费的吗?

是的,Xiaohongshu Browser 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Xiaohongshu Browser 支持哪些平台?

Xiaohongshu Browser 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Xiaohongshu Browser?

由 besty0121(@besty0121)开发并维护,当前版本 v1.2.1。

💬 留言讨论