Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器clawhub未标认证来源可访问clear审计提醒

xhs-tsXHS TS 搜索

Agent Skill

xhs-ts 用于处理浏览器自动化、网页检查和页面信息提取,适合在 OpenClaw 中需要让 Agent 打开页面、读取网页或验证前端流程时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

10,308

周安装

413

GitHub Stars

1

下载量

3,337
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:xhs-ts(XHS TS 搜索)
来源仓库:https://github.com/lv-saharan/xhs-ts
安装命令:
openclaw skills install xhs-ts
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install xhs-ts

简介

通过Playwright CLI自动化执行小红书各项操作,包括搜索与互动。

  • 适用于批量点赞、收藏、评论与数据抓取等高频操作需求。
  • 支持多账号管理与任务调度,提升运营效率与响应速度。xhs-ts 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 需配置浏览器环境与登录凭证,确保操作过程稳定可靠。
  • 频繁操作可能触发平台风控,建议控制频率并遵守使用规范。

SKILL.md

---name: xhs-ts description: | Automate Xiaohongshu (小红书/RedNote) operations via Playwright CLI — search notes, publish image/video posts, interact (like/collect/comment/follow), scrape data, manage multiple accounts with isolated cookies and anti-detection. Use when user mentions 小红书, xhs, Xiaohongshu, RedNote, 红书, 小红书运营, or works with xhs-ts/ directory, or wants to login, search, publish, interact, scrape, or manage multiple Xiaohongshu accounts. license: MIT compatibility: opencode metadata: version: "0.1.1" homepage: "https://github.com/lv-saharan/skills/tree/main/xhs-ts" openclaw: emoji: "📕" requires: bins: [node, npx] install: - id: node kind: node packages: [playwright, tsx, commander, dotenv] label: "Install dependencies (playwright, tsx, commander, dotenv)"


Xiaohongshu Automation Skill (xhs-ts)

Quick Reference

TaskCommandStatus
Loginnpm run login [-- --user <name>]✅ Implemented
Searchnpm run search -- "<keyword>" [-- --user <name>]✅ Implemented
Publishnpm run publish -- [options] [-- --user <name>]✅ Implemented
User Managementnpm run user✅ Implemented
Likenpm run like -- "<url>" [urls...] [-- --user <name>]✅ Implemented
Collectnpm run collect -- "<url>" [urls...] [-- --user <name>]✅ Implemented
Commentnpm run comment -- "<url>" "text"✅ Implemented
Follownpm run follow -- "<url>" [urls...]✅ Implemented
Scrape notenpm run scrape-note -- "<url>"✅ Implemented
Scrape usernpm run scrape-user -- "<url>"✅ Implemented
Browser startnpm run browser -- --start [--user <name>]✅ Implemented
Browser statusnpm run browser -- --status✅ Implemented
Browser stopnpm run browser -- --stop✅ Implemented
All commands support --user <name> for multi-account operations. Usage: npm run <command> -- [args] -- [options] Example: npm run search -- "美食" -- --limit 10 --user "小号"

Gotchas

Authentication

  1. Cookie expiry — Session cookies expire after ~30 days; NOT_LOGGED_IN → run npm run login
  2. Comment requires phone binding — Unbound accounts get 评论受限: 绑定手机
  3. URL must include xsec_token — Direct URLs may not work; use npm run search to get complete URLs

Anti-Detection

  1. Rate limiting — Keep 2-5 second intervals between operations
  2. Headless auto-detection — Linux servers (no DISPLAY) automatically force headless mode
  3. QR code file path — Headless mode: QR saved to users/{user}/tmp/qr_login_*.png

Platform Limits

  1. Short links not supported — xhslink.com URLs will fail; use full URLs
  2. Publish detection risk — Xiaohongshu may block automated publishing; test with secondary account

Multi-User Management

xhs-ts supports multiple Xiaohongshu accounts with isolated cookies and temporary files.

Directory Structure

xhs-ts/
├── users/                    # Multi-user directory
│   ├── users.json            # User metadata (current user, version: 3)
│   ├── default/              # Default user
│   │   ├── user-data/        # Playwright persistent context (auto-saves cookies, localStorage)
│   │   ├── profile.json      # Unified Profile data (meta + connection)
│   │   ├── fingerprint.json  # Device fingerprint
│   │   └── tmp/              # Temporary files (QR codes)
│   └── {username}/           # Same structure as default/
│       ├── user-data/
│       ├── profile.json
│       ├── fingerprint.json
│       └── tmp/
Version 3 Changes: meta.json merged into profile.json with meta and connection fields.

User Selection Priority

--user <name>  >  users.json current  >  default

Commands

# List all users
npm run user

# Set current user
npm run user:use -- "小号"
# Or: npm run user -- --set-current "小号"

# Reset to default user
npm run user -- --set-default

# Clean up corrupted user data (when login fails with USER_DATA_CORRUPTED)
npm run user -- --cleanup '<用户名>'

# Login with specific user
npm run login -- --user "小号"

# Search with specific user
npm run search -- "美食" --user "小号"

Error Recovery: Corrupted User Data

When login fails with USER_DATA_CORRUPTED error, the output includes suggestCleanup: true:

{
  "error": true,
  "code": "USER_DATA_CORRUPTED",
  "suggestCleanup": true,
  "canCleanup": true,
  "hint": "用户数据可能已损坏。请运行 npm run user -- --cleanup <用户名> 清理后重新登录。"
}

Agent workflow:

  1. Detect suggestCleanup: true in error output
  2. Ask user: "用户数据可能已损坏,是否执行清理?"
  3. If user confirms: run npm run user -- --cleanup <用户名>
  4. After cleanup succeeds: run npm run login -- --user <用户名>
Safety check: Cleanup is blocked (canCleanup: false) if browser is running for that user. Close browser first with npm run browser -- --stop-user <用户名>.

Output Format

All commands output JSON to stdout. The toAgent field provides actionable instructions.

toAgent Format

ACTION[:TARGET][:HINT]
ActionAgent Behavior
DISPLAY_IMAGEUse look_at to read image, send based on Channel type
RELAYForward message directly to user
WAITWait for user action, prompt HINT text
PARSEFormat data content and display

Channel-Specific Formatting

When toAgent is PARSE:notes, format output based on channel type:

ChannelFormatKey Rule
飞书交互卡片 + 反引号URL(逐条循环)每条 2 条消息;间隔 600ms+
微信个人号文字 + 图片(逐条发送)文字在前;每次一条,等待返回
企业微信图文 news 或 Markdownpicurl 直接用
CLI表格标准输出
完整格式规范、JSON 模板、回调处理见 references/channel-integration.md

Commands

Login

# QR code login (default)
npm run login

# Headless mode (QR saved to file)
npm run login -- --headless

# SMS login
npm run login -- --sms

# SMS login with phone number
npm run login -- --sms --phone "13800138000"

# Cookie string login (direct import)
npm run login -- --cookie-string "a1=xxx; webId=xxx; ..."

# Login with specific user
npm run login -- --user "小号"
ParameterValuesDefault
--qrQR code login✅ Default
--smsSMS login
--phonePhone number for SMS
--cookie-stringCookie string for direct login
--headlessRun in headless modefalse
--timeoutLogin timeout (ms)120000
--userUser namecurrent user

Search

# Basic search
npm run search -- "美食探店"

# With filters
npm run search -- "美食探店" --limit 10 --sort hot --note-type image --time-range week

# Search followed users only
npm run search -- "美食探店" --scope following
Output formatting: For sending results to Feishu/WeChat, see references/channel-integration.md
ParameterValuesDefault
--limitAny positive integer10
--skipNon-negative integer0
--sortgeneral, time_descending, hotgeneral
--note-typeall, image, videoall
--time-rangeall, day, week, monthall
--scopeall, followingall
--locationall, nearby, cityall

Publish

# Publish image note
npm run publish -- --title "标题" --content "正文" --images "img1.jpg,img2.jpg"

# Publish video note
npm run publish -- --title "标题" --content "正文" --video "video.mp4"

# With tags
npm run publish -- --title "标题" --content "正文" --images "img1.jpg" --tags "美食,探店"
⚠️ Warning: Xiaohongshu may detect and block automated publishing. Use secondary account for testing.

Interact (Like, Collect, Comment, Follow)

All interact commands require:

  • Login: Must be logged in
  • Valid URL: URLs must include xsec_token parameter
Use npm run search to get complete URLs with tokens.

Like

# Single note
npm run like -- "https://www.xiaohongshu.com/explore/noteId?xsec_token=xxx"

# Multiple notes (batch)
npm run like -- "url1" "url2" "url3"

# Custom delay between likes (default: 2000ms)
npm run like -- "url1" "url2" --delay 3000

Collect (Bookmark)

# Single note
npm run collect -- "https://www.xiaohongshu.com/explore/noteId?xsec_token=xxx"

# Multiple notes (batch)
npm run collect -- "url1" "url2"

# Custom delay between collects (default: 2000ms)
npm run collect -- "url1" "url2" --delay 3000

Comment

# Comment on a note
npm run comment -- "https://www.xiaohongshu.com/explore/noteId?xsec_token=xxx" "评论内容"

# With specific user
npm run comment -- "url" "评论内容" --user "小号"
⚠️ Phone Binding Required: Accounts without phone number cannot comment. Error: 评论受限: 绑定手机

Follow

# Follow single user
npm run follow -- "https://www.xiaohongshu.com/user/profile/userId"

# Follow multiple users (batch)
npm run follow -- "url1" "url2"

# Custom delay between follows (default: 2000ms)
npm run follow -- "url1" "url2" --delay 3000

Scrape

Scrape Note

# Basic scrape
npm run scrape-note -- "https://www.xiaohongshu.com/explore/noteId?xsec_token=xxx"

# Include comments
npm run scrape-note -- "url" --comments --max-comments 50
ParameterValuesDefault
--commentsInclude comments in outputfalse
--max-commentsMax comments to fetch20

Output: noteId, title, content, images, video, author, stats, tags, publishTime, location

Scrape User

# Basic scrape
npm run scrape-user -- "https://www.xiaohongshu.com/user/profile/userId"

# Include recent notes
npm run scrape-user -- "url" --notes --max-notes 24
ParameterValuesDefault
--notesInclude recent notes in outputfalse
--max-notesMax notes to fetch12

Output: userId, name, avatar, bio, stats, tags, recentNotes

Browser Management

Browser instances run in detached mode and persist after CLI exits. Agent is responsible for closing idle browsers.

# Start browser instance
npm run browser -- --start
npm run browser -- --start --user "小号"
npm run browser -- --start --headless

# Show status (includes lastActivityAt timestamp)
npm run browser -- --status

# List saved connections
npm run browser -- --list

# Stop instances
npm run browser -- --stop-user "小号"  # Stop specific user
npm run browser -- --stop              # Stop all instances
ParameterDescription
--startStart a browser instance
--stopStop all browser instances
--stop-user <name>Stop browser for specific user
--statusShow browser status (includes lastActivityAt)
--listList saved CDP connections
--user <name>User name (for --start)
--headlessRun in headless mode
Agent Responsibility: Check lastActivityAt from --status output. Close idle browsers (e.g., inactive for 20+ minutes) to free resources.

Agent Workflow

Typical User Requests

User saysAgent should
"搜索 XX"npm run search -- "XX" → 根据 Channel 格式化输出
"帮我点赞这个笔记"验证 URL 含 xsec_tokennpm run like -- "<url>"
"发布一篇笔记"npm run publish -- --title ... --content ... --images ...
"抓取这个笔记的数据"npm run scrape-note -- "<url>"
"切换账号"npm run user:use -- "<name>"npm run login -- --user "<name>"

Error Handling Flow

  1. 命令返回 NOT_LOGGED_INnpm run login
  2. 命令返回 USER_DATA_CORRUPTED → 询问用户 → npm run user -- --cleanup
  3. 命令返回 RATE_LIMITED → 等待 30s → 重试
  4. 浏览器空闲 20+ 分钟 → npm run browser -- --stop
Full error code reference: references/troubleshooting.md

References

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

75.44%
按下载量换算2,517

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills