Files
nanocode/my_xiaohongshu_cli/README.md
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

1.1 KiB

My Xiaohongshu CLI

基于自定义 Cookie 的小红书命令行工具。

安装

cd /home/ubuntu/nanocode/my_iaohongshu_cli
uv pip install -e .

或使用 pip:

pip install -e .

使用方法

# 检查登录状态
myxhs status

# 搜索笔记
myxhs search "旅行"

# 查看笔记详情
myxhs read 69ddda7a000000002100786c

# 获取首页推荐
myxhs feed

# 获取热搜榜
myxhs hot

# 查看用户信息
myxhs user 5f3d2e1a000000000101c1f2

# 查看用户笔记
myxhs user_notes 5f3d2e1a000000000101c1f2

# 点赞/取消点赞
myxhs like 69ddda7a000000002100786c
myxhs unlike 69ddda7a000000002100786c

默认从 /home/ubuntu/xiaohongshu_cookies.txt 读取 Cookie。

可通过 --cookie-file 指定其他路径:

myxhs --cookie-file /path/to/cookies.json status

Cookie 文件格式支持:

  • Chrome 扩展导出的 JSON 数组格式
  • 简单的 key-value JSON 对象

输出格式

所有命令支持 --json-output 输出 JSON 格式:

myxhs search "美食" --json-output

调试

使用 -v 开启调试日志:

myxhs -v search "编程"