xiaohongshutoolsXiaoHongShu (Little Red Book) data collection and interaction toolkit. Use when working with XiaoHongShu (小红书) platform for: (1) Searching and scraping notes/posts, (2) Getting user profiles and details, (3) Extracting comments and likes, (4) Following users and liking posts, (5) Fetching home feed and trending content. Automatically handles all encryption parameters (cookies, headers) including a1, webId, x-s, x-s-common, x-t, sec_poison_id, websectiga, gid, x-b3-traceid, x-xray-traceid. Supports guest mode and authenticated sessions via web_session cookie.
Install via ClawdBot CLI:
clawdbot install ChocomintX/xiaohongshutools小红书(XiaoHongShu / Little Red Book)数据采集和交互工具包。基于RedCrack纯Python逆向工程实现。
Dependencies are already installed:
pip install aiohttp loguru pycryptodome getuseragent
import asyncio
import sys
sys.path.insert(0, r'C:\\Users\\Chocomint\\.openclaw\\workspace\\xiaohongshu\\scripts')
from request.web.xhs_session import create_xhs_session
async def main():
# ✅ 推荐:不强制代理(有代理再填 proxy)
# 说明:当前小红书接口经常对“未登录/游客”限制搜索能力。
# 如果 search 报 code=-104(未登录无权限),请提供 web_session。
xhs = await create_xhs_session(proxy=None, web_session="YOUR_WEB_SESSION_OR_NONE")
# Search notes
res = await xhs.apis.note.search_notes("美妆")
data = await res.json()
print(data)
await xhs.close_session()
asyncio.run(main())
Search notes by keyword:
res = await xhs_session.apis.note.search_notes("口红")
Get home feed (trending):
# 注意:get_homefeed 需要 category 参数
res = await xhs_session.apis.note.get_homefeed(
xhs_session.apis.note.homefeed_category_enum.FOOD
)
Get note detail:
# note_detail 需要 note_id + xsec_token(有时在搜索结果 item 里叫 xsec_token)
res = await xhs_session.apis.note.note_detail(note_id, xsec_token)
Get user info:
res = await xhs_session.apis.auth.get_self_simple_info()
Follow a user:
res = await xhs_session.apis.user.follow_user(user_id)
Like a note:
res = await xhs_session.apis.note.like_note(note_id)
Get comments for a note:
# comments 也需要 note_id + xsec_token
res = await xhs_session.apis.comments.get_comments(note_id, xsec_token)
代理不是硬性要求(本技能可以 proxy=None 运行)。但在以下情况建议使用代理:
不使用代理:
xhs = await create_xhs_session(proxy=None, web_session=None)
使用代理:
xhs = await create_xhs_session(
proxy="http://127.0.0.1:7890",
web_session="your_web_session_cookie" # 需要登录能力时再提供
)
All encryption parameters are automatically generated:
Configuration file: scripts/request/web/encrypt/web_encrypt_config.ini
xhs_session = await create_xhs_session(proxy="http://127.0.0.1:7890")
xhs_session = await create_xhs_session(
proxy="http://127.0.0.1:7890",
web_session="030037afxxxxxxxxxxxxxxxxxxxaeb59d5b4" # Your cookie
)
await xhs_session.close_session()
697cc945000000000a02cdad。https://www.xiaohongshu.com/explore/?xsec_token=...&xsec_source=pc_search 为了避免长链接难看,优先用文本标签超链接:
标题All APIs are accessible via xhs_session.apis.*:
Authentication (apis.auth):
get_self_simple_info() - Get current user infoNotes (apis.note):
search_notes(keyword) - Search notes by keywordget_homefeed(category) - Get home feednote_detail(note_id, share_token) - Get note detailslike_note(note_id) - Like a noteComments (apis.comments):
get_comments(note_id, share_token) - Get note commentsUser (apis.user):
follow_user(user_id) - Follow a userget_user_info(user_id) - Get user detailsasync def search_example():
xhs_session = await create_xhs_session(proxy="http://127.0.0.1:7890")
# Search for makeup tutorials
res = await xhs_session.apis.note.search_notes("美妆教程")
data = await res.json()
for note in data['data']['items']:
print(f"Title: {note['display_title']}")
print(f"Author: {note['user']['nickname']}")
print(f"Likes: {note['liked_count']}")
print("---")
await xhs_session.close_session()
async def comments_example():
xhs_session = await create_xhs_session(proxy="http://127.0.0.1:7890")
note_id = "64f1a2d30000000013003689"
res = await xhs_session.apis.comments.get_comments(note_id, "")
data = await res.json()
for comment in data['data']['comments']:
print(f"User: {comment['user']['nickname']}")
print(f"Content: {comment['content']}")
print(f"Likes: {comment['like_count']}")
print("---")
await xhs_session.close_session()
async def profile_example():
xhs_session = await create_xhs_session(
proxy="http://127.0.0.1:7890",
web_session="your_cookie_here"
)
# Get self info
res = await xhs_session.apis.auth.get_self_simple_info()
data = await res.json()
print(f"Username: {data['data']['user']['nickname']}")
print(f"Followers: {data['data']['user']['follows']}")
print(f"Fans: {data['data']['user']['fans']}")
await xhs_session.close_session()
Based on RedCrack - Pure Python reverse engineering of XiaoHongShu's encryption algorithms.
What's automatically handled:
No JavaScript runtime required - All encryption is pure Python.
OtherStatusError: 461异常,或者接口返回看似 success=true 但 HTTP=461。应对建议:
pip install aiohttp loguru pycryptodome getuseragentsys.path.insert()Generated Feb 27, 2026
Brands can use this skill to monitor mentions, track trending topics, and analyze competitor posts on Xiaohongshu. It enables automated collection of notes and comments for sentiment analysis and market research, helping brands stay updated on consumer preferences and industry trends.
Marketing agencies can leverage this skill to identify potential influencers by scraping user profiles, analyzing engagement metrics like likes and comments, and automating follow actions. This streamlines influencer discovery and outreach for targeted campaigns.
Content creators and media companies can use this skill to gather trending content from home feeds, analyze popular keywords, and extract note details to inform content creation. It helps in understanding what resonates with audiences and optimizing posting strategies.
Researchers can employ this skill to collect large-scale data from Xiaohongshu for studies on consumer behavior, cultural trends, or platform dynamics. It supports automated data extraction of notes and comments for qualitative and quantitative analysis.
E-commerce businesses can utilize this skill to scrape product reviews and recommendations from notes, analyze user feedback in comments, and track trending items. This aids in product development, inventory planning, and competitive analysis.
Offer a subscription-based service that provides businesses with insights from Xiaohongshu data, such as trend reports, influencer rankings, and sentiment analysis. Revenue is generated through monthly or annual licensing fees.
Provide managed services for brands needing social media monitoring, influencer outreach, or content strategy on Xiaohongshu. Revenue comes from project-based contracts or retainer fees for ongoing support and automation.
Collect and anonymize data from Xiaohongshu to sell aggregated datasets or insights to third parties like market research firms or academic institutions. Revenue is generated through one-time sales or licensing agreements.
💬 Integration Tip
Ensure proper proxy setup to avoid rate limits and handle web_session cookies for authenticated features like following users.
Automate Xiaohongshu (RedNote) content operations using a Python client for the xiaohongshu-mcp server. Use for: (1) Publishing image, text, and video content, (2) Searching for notes and trends, (3) Analyzing post details and comments, (4) Managing user profiles and content feeds. Triggers: xiaohongshu automation, rednote content, publish to xiaohongshu, xiaohongshu search, social media management.
Feishu-integrated wrapper for the capability-evolver. Manages the evolution loop lifecycle (start/stop/ensure), sends rich Feishu card reports, and provides...
The Baidu Baike Component is a knowledge service tool designed to query authoritative encyclopedia explanations for various nouns. Its core function is given a specific "noun" (object, person, location, concept, event, etc.) provided by the user, it returns a standardized, detailed entry explanation sourced from Baidu Baike.
Draft and publish posts to 小红书 (Xiaohongshu/RED). Use when creating content for 小红书, drafting posts, generating cover images, or publishing via browser automation. Covers the full workflow from content creation to browser-based publishing, including cover image generation with Pillow.
AI-assisted creation, rendering, and automated publishing of Xiaohongshu-style content with support for Markdown to image cards and data tracking.
小红书全能助手 — 文案生成、封面制作、内容发布与管理。当用户要求写小红书笔记、生成小红书文案/标题/封面、发小红书、搜索小红书、评论点赞收藏等任何小红书相关操作时使用。支持一站式从文案创作到自动发布的完整流程。封面AI生图需配置可选环境变量(GEMINI_API_KEY 或 IMG_API_KEY 或 HUNY...