Xiaohongshu Hub

SKILL内容创作
内容创作 未标注权限 许可证不明确

Skill for reading and writing Xiaohongshu (XHS) data using Python + UV. It depends only on httpx + pycryptodome, automatically retrieves cookies via `browser_use get_cookies` to complete authentication, and requires no manual copying. It supports searching notes, users, and topics; reading note details and comments; recommendation feeds; trending lists; social actions (follow/favorite); interactions (like/comment/reply); notification queries; creator note management; and more. This skill must be triggered when the user mentions "Xiaohongshu," "XHS," "scraping Xiaohongshu," "searching Xiaohongshu notes," "Xiaohongshu comments," "xiaohongshu-hub," "reading Xiaohongshu data," "Xiaohongshu Cookie," or any scenario that requires programmatically reading or writing Xiaohongshu content.

一句话选型结论

按资料字段整理

Xiaohongshu Hub是内容创作类的 Agent Skill,安装方式:GitHub 仓库,权限级别未标注,许可证不明确,没有现成安装命令,需按说明手动放置 SKILL.md。技能本质是给模型读的说明书,效果取决于模型与客户端;装完先用一个小任务验证,再放进正式流程。

分类内容创作 安装方式GitHub 仓库 权限级别未标注权限 许可证许可证不明确
累计安装 未标注 本周 未标注
GitHub 星标 未标注 仓库 minisskills
下载量 未标注 技能市场下载数
权限级别 未标注权限 安装前请确认风险范围
许可证 许可证不明确 未说明

安装

GitHub 仓库
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
  1. 1
    确认客户端支持

    确认你的客户端支持 Skills(Claude、Codex、Cursor 等),并升级到较新的版本。

  2. 2
    拿到技能文件

    按安装说明或仓库 README,把 SKILL.md 放到客户端的 skills 目录(一般一个技能一个文件夹)。

  3. 3
    刷新技能列表

    重新打开客户端,或刷新技能列表,让新放进来的技能被加载。

  4. 4
    验证是否生效

    问一句「你有哪些技能」,确认列表里出现它,再拿一个小任务试跑。

技能档案

内容创作
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方openminis仓库 minisskills · 版本 未标注
宿主客户端未标注技能可被这些客户端加载
安装方式GitHub 仓库安装包 openminis/minisskills
权限级别未标注权限安装前请确认风险范围
许可证未说明许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验未标注上游最后核验时间 · 数据更新 2026-08-01
正文体量10.7 KBSKILL.md 原文大小,越大说明说明书写得越细

典型使用场景

3 类
按分类整理的常见用法,具体以 SKILL.md 为准
写文章与脚本

按主题产出初稿与分镜脚本。

改稿与润色

把草稿改顺、统一语气。

多平台文案改写

同一内容按平台改成长短不同的版本。

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 基础信息齐全,可以先按说明装一个试试。

先想清楚的地方

  • 没有标注权限级别,实际能做什么要装好后确认。
  • 许可证不明确,商用或二次分发前先到仓库确认条款。
  • 没有现成安装命令,要按安装说明或仓库 README 手动放置。
  • 没有做站内核验,内容以作者仓库为准。
  • 技能只是说明书,实际效果取决于模型与客户端,装完先用小任务试一遍。

更适合

  • 需要在内容创作场景里给模型补一套做法的人。
  • 愿意先读一遍 SKILL.md、确认它会让模型做什么的人。

不太适合

  • 对许可证要求很严、必须明确可商用的人。
  • 只想装完就自动变强、不打算看说明书的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
技能权限级别安装方式累计安装宿主客户端安装命令
Xiaohongshu Hub当前 未标注权限 GitHub 仓库 未标注 未标注 无
AI 视频生成 调用外部服务 GitHub 仓库 431.3 万 Codex、Claude、Cursor 有
视频帧 联网访问 ClawHub 市场 262.1 万 OpenClaw 有
Markdown 转换器 写入文件 ClawHub 市场 135.3 万 OpenClaw 有
哔哩哔哩全合一 接触敏感数据 ClawHub 市场 64.1 万 OpenClaw 有
Remotion video toolkit 命令行 浏览器控制 ClawHub 市场 63.9 万 OpenClaw 有

SKILL.md 全文

10.7 KB
模型实际读到的说明书原文,来自技能仓库

xiaohongshu-hub

> Modified from: jackwener/xiaohongshu-cli (Apache-2.0)
>
> This skill simplifies and modifies the original repository as follows:
> - Removes the browser-cookie3 / click / rich / PyYAML / qrcode dependencies
> - Changes Cookie authentication to pass a dict directly or read from environment variables, without automatic browser extraction
> - Removes the CLI layer (commands/) and QR login module (qr_login.py)
> - Keeps the complete reverse-engineered signing algorithm in signing.py, implemented with the standard library only and no third-party dependencies
> - Keeps AES-128-CBC signing in creator_signing.py (depends on pycryptodome)
> - In the Minis environment, cookies are automatically retrieved through browser_use get_cookies


File Structure

/var/minis/skills/xiaohongshu-hub/
├── SKILL.md
├── pyproject.toml          # UV project configuration (httpx + pycryptodome only)
└── scripts/
    ├── __init__.py
    ├── constants.py        # Constants (Host, UA, SDK version, etc.)
    ├── exceptions.py       # Structured exceptions (6 error types)
    ├── signing.py          # Main API signing (x-s / x-s-common / x-t), standard library only
    ├── creator_signing.py  # Creator API signing (AES-128-CBC)
    └── client.py           # XhsClient core class (all API methods)

Authentication Methods

The Xiaohongshu Web API uses three key cookies:

Cookie Description
a1 User identity identifier and core signing algorithm parameter (required)
web_session Login session (required)
webId Device ID (recommended)

Method 1: Automatically Retrieve with browser_use (Preferred in the Minis Environment)

In Minis, you can use the browser_use tool to navigate to Xiaohongshu, then use get_cookies to read the cookies automatically.
Raw Cookie values will not appear in the conversation. They are passed securely through an offload env file.

Steps:
1. Use browser_use navigate to open https://www.xiaohongshu.com and confirm that you are logged in.
2. Use browser_use get_cookies to retrieve a1, web_session, and webId separately.
- The tool returns an offload env file path, such as /var/minis/offloads/env_cookies_xxx.sh.
- Raw Cookie values do not appear in the conversation context.
3. Load the env file before use:

. /var/minis/offloads/env_cookies_xxx.sh
# The file exports variables such as COOKIE_A1 / COOKIE_WEB_SESSION / COOKIE_WEBID
export XHS_A1="$COOKIE_A1"
export XHS_WEB_SESSION="$COOKIE_WEB_SESSION"
export XHS_WEBID="$COOKIE_WEBID"

> Note: get_cookies only applies to the current page's domain. Navigate to https://www.xiaohongshu.com before calling it.

Method 2: Manually Retrieve Cookies from Browser DevTools

  1. Log in to Xiaohongshu and open DevTools -> Application -> Cookies -> https://www.xiaohongshu.com.
  2. Find the values for a1, web_session, and webId.
  3. Save them to Minis environment variables (Settings -> Environments): XHS_A1 / XHS_WEB_SESSION / XHS_WEBID.

Ways to Pass Cookies (Three Methods, Highest to Lowest Priority)

  1. Environment variables: XHS_A1 + XHS_WEB_SESSION + XHS_WEBID (recommended)
  2. Pass directly in code: XhsClient({"a1": ..., "web_session": ..., "webId": ...})
  3. Script arguments: Pass through arguments such as -a1 / --web-session

Quick Start

Set Up the Environment

cd /var/minis/skills/xiaohongshu-hub
uv sync

Call as a Python Library (Recommended)

import os, json, sys
sys.path.insert(0, "/var/minis/skills/xiaohongshu-hub")
from scripts.client import XhsClient

# Method 1: Build from environment variables (recommended)
client = XhsClient.from_env()

# Method 2: Pass a Cookie dict directly
client = XhsClient({
    "a1":          os.environ["XHS_A1"],
    "web_session": os.environ["XHS_WEB_SESSION"],
    "webId":       os.environ["XHS_WEBID"],
})

with client:
    # Current user information
    me = client.get_self_info()
    print("User:", me.get("nickname"))

    # Search notes
    results = client.search_notes("Food", page=1)
    for item in results.get("items", [])[:5]:
        note = item.get("note_card", {})
        print(f"  - {note.get('display_title', '')}")

    # Recommendation feed
    feed = client.get_home_feed()
    print(f"Recommendation feed: {len(feed.get('items', []))} items")

    # Trending notes (travel)
    hot = client.get_hot_feed("homefeed.travel_v3")
    print(f"Trending travel: {len(hot.get('items', []))} items")

Call Through a Script (Shell Environment)

# Search notes and output JSON
cd /var/minis/skills/xiaohongshu-hub
uv run python -c "
import os, json, sys
sys.path.insert(0, '.')
from scripts.client import XhsClient
with XhsClient.from_env() as c:
    r = c.search_notes('Travel', page=1)
    print(json.dumps(r, ensure_ascii=False, indent=2))
"

# Get current user information
uv run python -c "
import os, json, sys
sys.path.insert(0, '.')
from scripts.client import XhsClient
with XhsClient.from_env() as c:
    print(json.dumps(c.get_self_info(), ensure_ascii=False, indent=2))
"

API Method Quick Reference

User

Method Description
get_self_info() Get information about the currently logged-in user
get_user_info(user_id) Get profile information for a specified user
get_user_notes(user_id, cursor="") Get a list of notes posted by a user

Search

Method Description
search_notes(keyword, page=1, sort="general", note_type=0) Search notes
search_users(keyword, page=1) Search users
search_topics(keyword) Search topics/tags

sort options: "general" / "popularity_descending" / "time_descending"
note_type options: 0 = all / 1 = video / 2 = image and text

Notes

Method Description
get_note_by_id(note_id, xsec_token="") Get note details
get_comments(note_id, cursor="", xsec_token="") Get comments (single page)
get_all_comments(note_id, xsec_token="", max_pages=20) Automatically page through and get all comments
get_sub_comments(note_id, comment_id, cursor="", xsec_token="") Get comment replies

Feed / Discover

Method Description
get_home_feed(category="homefeed_recommend") Recommendation feed
get_hot_feed(category="homefeed.food_v3") Trending notes (by category)

Trending categories: fashion_v3 / food_v3 / cosmetics_v3 / movie_and_tv_v3 /
career_v3 / love_v3 / household_product_v3 / gaming_v3 / travel_v3 / fitness_v3

Social

Method Description
follow_user(user_id) Follow a user
unfollow_user(user_id) Unfollow
get_user_favorites(user_id, cursor="") Get a user's favorites

Interaction

Method Description
like_note(note_id, xsec_token="") Like
unlike_note(note_id, xsec_token="") Unlike
collect_note(note_id, xsec_token="") Favorite
uncollect_note(note_id, xsec_token="") Unfavorite
post_comment(note_id, content, xsec_token="") Post a comment
reply_comment(note_id, comment_id, content, xsec_token="") Reply to a comment
delete_comment(note_id, comment_id) Delete your own comment

Notifications

Method Description
get_unread_count() Number of unread notifications
get_notifications_mentions(cursor="") Comments / @ notifications
get_notifications_likes(cursor="") Like / favorite notifications
get_notifications_connections(cursor="") New follower notifications

Creator

Method Description
get_my_notes(page=0) Get a list of notes you posted
delete_note(note_id) Delete a note (experimental)

Error Handling

from scripts.exceptions import (
    NeedVerifyError,    # CAPTCHA triggered (HTTP 461/471)
    SessionExpiredError, # Cookie expired (code -100)
    IpBlockedError,     # IP blocked (code 300012)
    SignatureError,     # Signing failed (code 300015)
    XhsApiError,        # Other API errors (base class)
)

try:
    result = client.search_notes("Food")
except NeedVerifyError:
    print("A CAPTCHA was triggered. Complete verification in the browser and try again.")
except SessionExpiredError:
    print("Cookie has expired. Retrieve it again.")
except IpBlockedError:
    print("IP is blocked. Switch networks.")
except XhsApiError as e:
    print(f"API error: {e} (code={e.code})")

Anti-Risk-Control Mechanisms

This skill inherits the complete anti-risk-control implementation from the original repository:

  • Gaussian jitter: Uses a truncated Gaussian distribution for request intervals (not fixed intervals) to simulate natural browsing rhythms
  • Random long pauses: About 5% of requests wait an additional 2 to 5 seconds to simulate reading behavior
  • Exponential backoff: Automatically retries HTTP 429/5xx (up to 3 times)
  • CAPTCHA cooldown: After a CAPTCHA is triggered, automatically waits 5 -> 10 -> 20 -> 30 seconds and permanently doubles the request interval
  • Browser fingerprint consistency: macOS Chrome UA, with session-level GPU/resolution/CPU kept fixed
  • Complete signing: x-s / x-s-common / x-t signing (reverse-engineered from the web client)

Notes

  • Cookies are usually valid for several days to several weeks. After they expire, retrieve them again through browser_use get_cookies.
  • Use a dedicated account to avoid risk-control flags on your main account.
  • Write operations (comments, likes, etc.) carry a higher risk-control risk than read operations. Use them with discretion.
  • get_all_comments pages through up to 20 pages by default. You can adjust this with max_pages.

常见问题

5 问
答案由本站依据条目字段整理
Xiaohongshu Hub怎么安装?

没有现成安装命令:按安装说明或仓库 README,把 SKILL.md 放进客户端的 skills 目录(一般一个技能一个文件夹)。

Xiaohongshu Hub支持哪些客户端?

资料没有标注宿主客户端,但只要客户端支持 Skills(Claude、Codex、Cursor 等),一般都能加载。

Xiaohongshu Hub权限高吗,安全吗?

权限级别为未标注权限。安装前先看它会读取或写入哪些内容。

Xiaohongshu Hub收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于技能本身和所用的模型或客户端,正式使用前按作者说明确认。

Xiaohongshu Hub用什么许可证?

许可证标注为 未说明(许可证不明确)。商用或二次分发前请到仓库确认条款原文。

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 未标注。