Install
openclaw skills install @cooperiano/xhs-dataopenclaw skills install @cooperiano/xhs-data| 引擎 | 技术 | 适合 |
|---|---|---|
| 🔌 API引擎 | RedCrack 纯Python逆向 | 搜索/评论/用户信息/关注点赞 |
| 🌐 浏览器引擎 | Selenium/Playwright | 用户主页滚动/单篇提取/媒体下载 |
pip install aiohttp loguru pycryptodome getuseragent
xhs = await create_xhs_session(proxy=None, web_session=None)
res = await xhs.apis.note.search_notes("关键词")
res = await xhs.apis.note.note_detail(note_id, xsec_token)
res = await xhs.apis.comments.get_comments(note_id, xsec_token)
res = await xhs.apis.user.get_user_info(user_id)
python scripts/xiaohongshu_extract.py "<url>" --pretty --output /tmp/note.json
# Selenium + Chrome, 滚动到底部, 提取所有note_id
# 输出: note_ids.txt + note_links.json + note_links.md
# 保存 page.html + post_data.json + post.md
# 自动提取 image(jpg/png/webp) + video(mp4)
# 限制: 每篇≤10图, ≤5视频
~/disk/xiaohongshu/data/{userId}/~/disk/xiaohongshu/posts/{noteId}/proxy="http://127.0.0.1:7890"xiaohongshu.com/explore/<note_id>xiaohongshu.com/user/profile/<user_id>