@lucasygu/redbook 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
[English](#english) | 中文
|
|
6
6
|
|
|
7
|
+
> ### 最快上手方式
|
|
8
|
+
>
|
|
9
|
+
> 把这段话发给你的 AI 助手(Claude Code、Cursor、Codex、Windsurf 等):
|
|
10
|
+
>
|
|
11
|
+
> **"帮我安装 `@lucasygu/redbook` 这个小红书 CLI 工具,然后运行 `redbook whoami` 验证是否能正常连接。GitHub 地址:https://github.com/lucasygu/redbook"**
|
|
12
|
+
>
|
|
13
|
+
> AI 会自动完成安装、验证连接、处理可能的 Cookie 问题。你只需要确保已在 Chrome 中登录 xiaohongshu.com。
|
|
14
|
+
|
|
7
15
|
## 安装
|
|
8
16
|
|
|
9
17
|
```bash
|
|
@@ -12,6 +20,8 @@ npm install -g @lucasygu/redbook
|
|
|
12
20
|
|
|
13
21
|
需要 Node.js >= 22。使用 Chrome 浏览器的 Cookie —— 请先在 Chrome 中登录 xiaohongshu.com。
|
|
14
22
|
|
|
23
|
+
安装后运行 `redbook whoami` 验证连接。如果遇到 macOS 钥匙串弹窗,请点击"始终允许"。CLI 会自动检测所有 Chrome 配置文件,找到你的小红书登录状态。
|
|
24
|
+
|
|
15
25
|
## 快速开始
|
|
16
26
|
|
|
17
27
|
```bash
|
|
@@ -37,6 +47,9 @@ redbook user-posts <userId>
|
|
|
37
47
|
# 搜索话题标签
|
|
38
48
|
redbook topics "Claude Code"
|
|
39
49
|
|
|
50
|
+
# 分析爆款笔记
|
|
51
|
+
redbook analyze-viral https://www.xiaohongshu.com/explore/abc123
|
|
52
|
+
|
|
40
53
|
# 发布图文笔记
|
|
41
54
|
redbook post --title "标题" --body "正文内容" --images cover.png
|
|
42
55
|
redbook post --title "测试" --body "..." --images img.png --private
|
|
@@ -61,7 +74,8 @@ redbook post --title "测试" --body "..." --images img.png --private
|
|
|
61
74
|
|
|
62
75
|
| 选项 | 说明 | 默认值 |
|
|
63
76
|
|------|------|--------|
|
|
64
|
-
| `--cookie-source <浏览器>` | Cookie
|
|
77
|
+
| `--cookie-source <浏览器>` | Cookie 来源浏览器(chrome, safari, firefox) | `chrome` |
|
|
78
|
+
| `--chrome-profile <名称>` | Chrome 配置文件目录名(如 "Profile 1"),默认自动检测 | 自动 |
|
|
65
79
|
| `--json` | JSON 格式输出 | `false` |
|
|
66
80
|
|
|
67
81
|
### 搜索选项
|
|
@@ -82,6 +96,15 @@ redbook post --title "测试" --body "..." --images img.png --private
|
|
|
82
96
|
| `--topic <关键词>` | 附加话题标签 |
|
|
83
97
|
| `--private` | 发布为私密笔记 |
|
|
84
98
|
|
|
99
|
+
## 常见问题
|
|
100
|
+
|
|
101
|
+
| 问题 | 解决方案 |
|
|
102
|
+
|------|----------|
|
|
103
|
+
| `No 'a1' cookie found` | 在 Chrome 中登录 xiaohongshu.com,然后重试 |
|
|
104
|
+
| macOS 钥匙串弹窗 | 输入密码后点击"始终允许",CLI 需要读取 Chrome 的加密 Cookie |
|
|
105
|
+
| 多个 Chrome 配置文件 | CLI 自动扫描所有配置文件。如需指定:`--chrome-profile "Profile 1"` |
|
|
106
|
+
| 使用 Brave/Arc 等浏览器 | 尝试 `--cookie-source safari`,或在 Chrome 中登录 |
|
|
107
|
+
|
|
85
108
|
## 工作原理
|
|
86
109
|
|
|
87
110
|
`redbook` 从 Chrome 读取小红书的登录 Cookie(通过 [@steipete/sweet-cookie](https://github.com/nicklockwood/sweet-cookie)),然后用 TypeScript 实现的签名算法对 API 请求签名。无需浏览器自动化,无需 headless Chrome —— 纯 HTTP 请求。
|
|
@@ -138,6 +161,14 @@ Cookie 提取使用 [@steipete/sweet-cookie](https://github.com/nicklockwood/swe
|
|
|
138
161
|
|
|
139
162
|
A fast CLI tool for [Xiaohongshu (小红书 / RED)](https://www.xiaohongshu.com) — search notes, read content, analyze creators, and publish posts. Uses browser cookie auth (no API key needed).
|
|
140
163
|
|
|
164
|
+
> ### Easiest way to get started
|
|
165
|
+
>
|
|
166
|
+
> Paste this to your AI coding agent (Claude Code, Cursor, Codex, Windsurf, etc.):
|
|
167
|
+
>
|
|
168
|
+
> **"Install the `@lucasygu/redbook` Xiaohongshu CLI tool and run `redbook whoami` to verify it works. Repo: https://github.com/lucasygu/redbook"**
|
|
169
|
+
>
|
|
170
|
+
> The agent will handle installation, verify the connection, and troubleshoot any cookie issues. Just make sure you're logged into xiaohongshu.com in Chrome first.
|
|
171
|
+
|
|
141
172
|
## Install
|
|
142
173
|
|
|
143
174
|
```bash
|
|
@@ -146,6 +177,8 @@ npm install -g @lucasygu/redbook
|
|
|
146
177
|
|
|
147
178
|
Requires Node.js >= 22. Uses cookies from your Chrome browser session — you must be logged into xiaohongshu.com in Chrome.
|
|
148
179
|
|
|
180
|
+
After installing, run `redbook whoami` to verify the connection. If macOS shows a Keychain prompt, click "Always Allow". The CLI auto-detects all Chrome profiles to find your XHS session.
|
|
181
|
+
|
|
149
182
|
## Quick Start
|
|
150
183
|
|
|
151
184
|
```bash
|
|
@@ -171,6 +204,9 @@ redbook user-posts <userId>
|
|
|
171
204
|
# Search hashtags
|
|
172
205
|
redbook topics "Claude Code"
|
|
173
206
|
|
|
207
|
+
# Analyze a viral note
|
|
208
|
+
redbook analyze-viral https://www.xiaohongshu.com/explore/abc123
|
|
209
|
+
|
|
174
210
|
# Publish (requires image)
|
|
175
211
|
redbook post --title "标题" --body "正文" --images cover.png
|
|
176
212
|
redbook post --title "测试" --body "..." --images img.png --private
|
|
@@ -195,7 +231,8 @@ redbook post --title "测试" --body "..." --images img.png --private
|
|
|
195
231
|
|
|
196
232
|
| Option | Description | Default |
|
|
197
233
|
|--------|-------------|---------|
|
|
198
|
-
| `--cookie-source <browser>` | Browser to read cookies from | `chrome` |
|
|
234
|
+
| `--cookie-source <browser>` | Browser to read cookies from (chrome, safari, firefox) | `chrome` |
|
|
235
|
+
| `--chrome-profile <name>` | Chrome profile directory name (e.g., "Profile 1"). Auto-detected if omitted. | auto |
|
|
199
236
|
| `--json` | Output as JSON | `false` |
|
|
200
237
|
|
|
201
238
|
### Search Options
|
|
@@ -216,6 +253,15 @@ redbook post --title "测试" --body "..." --images img.png --private
|
|
|
216
253
|
| `--topic <keyword>` | Topic/hashtag to search and attach |
|
|
217
254
|
| `--private` | Publish as private note |
|
|
218
255
|
|
|
256
|
+
## Troubleshooting
|
|
257
|
+
|
|
258
|
+
| Problem | Solution |
|
|
259
|
+
|---------|----------|
|
|
260
|
+
| `No 'a1' cookie found` | Log into xiaohongshu.com in Chrome, then retry |
|
|
261
|
+
| macOS Keychain prompt | Enter your password and click "Always Allow" — the CLI needs to decrypt Chrome's cookies |
|
|
262
|
+
| Multiple Chrome profiles | The CLI auto-scans all profiles. To pick one: `--chrome-profile "Profile 1"` |
|
|
263
|
+
| Using Brave/Arc/other | Try `--cookie-source safari`, or log into xiaohongshu.com in Chrome |
|
|
264
|
+
|
|
219
265
|
## How It Works
|
|
220
266
|
|
|
221
267
|
`redbook` reads your XHS session cookies from Chrome (via [@steipete/sweet-cookie](https://github.com/nicklockwood/sweet-cookie)) and signs API requests using a TypeScript port of the XHS signing algorithm. No browser automation, no headless Chrome — just HTTP requests.
|