yuanflow-cli 0.1.4 → 0.1.6

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 CHANGED
@@ -29,6 +29,12 @@ yuanflow-cli douyin video-detail "https://v.douyin.com/xxx/" --format agent-json
29
29
  yuanflow-cli shortcuts douyin
30
30
  yuanflow-cli commands list
31
31
  yuanflow-cli schema douyin.video-detail
32
+ yuanflow-cli schema comments.douyin.comments
33
+ yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
34
+ yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
35
+ yuanflow-cli works download --platform douyin --target "https://v.douyin.com/xxx/" --region CN --format agent-json
36
+ yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json
37
+ yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json
32
38
  yuanflow-cli list douyin
33
39
  ```
34
40
 
@@ -40,6 +46,47 @@ YUANCHUANG_API_TOKEN=<你的令牌>
40
46
 
41
47
  token 优先级:`--token` > `YUANCHUANG_API_TOKEN` > 本地 `config.token`。独立 CLI 用户可以使用环境变量或 `config set-token`;在 YuanFlow 主程序内使用时,token 由主程序认证系统注入,不需要手动配置。
42
48
 
49
+ ### 作品评论采集
50
+
51
+ 评论采集统一走 `comments collect`,用于把 Agent 的自然语言需求稳定映射到平台评论接口:
52
+
53
+ ```bash
54
+ yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
55
+ yuanflow-cli comments collect --platform xiaohongshu --target note_id --action replies --comment-id root_comment_id --format agent-json
56
+ yuanflow-cli comments collect --platform youtube --target video_id --action comments --dry-run --format agent-json
57
+ ```
58
+
59
+ 常用参数:
60
+
61
+ - `--platform`:平台标识,如 `douyin`、`xiaohongshu`、`bilibili`、`wechat_mp`、`tiktok`、`instagram`、`kuaishou`、`reddit`、`twitter`、`weibo`、`youtube`、`zhihu`。
62
+ - `--action`:评论类型,默认 `comments`,可选 `replies`、`post_comments`、`post_replies`。
63
+ - `--target`:作品、文章、帖子、视频或回答 ID,也可以传支持的平台链接。
64
+ - `--comment-id`:采集二级评论或评论回复时使用。
65
+ - `--prefer fallback`:使用备用接口。
66
+ - `--dry-run`:只预览请求映射,不发起真实接口请求,也不要求 token。
67
+
68
+ Agent 可以先用 `yuanflow-cli commands list` 查看全部命令,再用 `yuanflow-cli schema comments.douyin.comments` 查看某个评论采集命令的参数、接口路径和返回说明。
69
+
70
+ ### 综合作品工具
71
+
72
+ 四类综合工具统一走受控命令,适合 Agent 通过自然语言稳定调用:
73
+
74
+ ```bash
75
+ yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
76
+ yuanflow-cli works download --platform youtube --target "dQw4w9WgXcQ" --format agent-json
77
+ yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json
78
+ yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json
79
+ ```
80
+
81
+ 命令 key:
82
+
83
+ - `works.<platform>.detail`:单作品详情。
84
+ - `works.<platform>.download`:播放/下载地址候选或视频流信息。
85
+ - `search.<platform>.content`:内容、作品、笔记、文章、帖子搜索。
86
+ - `search.<platform>.users`:账号、用户、作者、频道搜索。
87
+
88
+ Agent 不确定参数时先执行 `commands list`,再用 `schema works.douyin.detail` 或 `schema search.xiaohongshu.content` 查看参数。`--dry-run` 可预览请求映射,不发起真实接口请求,也不要求 token。
89
+
43
90
  ## Skill 安装器
44
91
 
45
92
  ```bash
@@ -104,6 +104,14 @@ function resolveLocalSkillRoot(packageRoot) {
104
104
  }
105
105
 
106
106
  async function prepareSkillSource({ packageRoot }) {
107
+ const localRoot = resolveLocalSkillRoot(packageRoot);
108
+ if (localRoot) {
109
+ return {
110
+ sourceRoot: localRoot,
111
+ cleanup() {},
112
+ };
113
+ }
114
+
107
115
  const repoConfig = readRepositoryConfig(packageRoot);
108
116
  const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'yuanflow-skill-'));
109
117
  const archiveFile = path.join(tempRoot, `${repoConfig.repo}-${repoConfig.ref}.tar.gz`);
@@ -131,15 +139,6 @@ async function prepareSkillSource({ packageRoot }) {
131
139
  cloneRepository({ repoConfig, targetDir: cloneDir });
132
140
  sourceRoot = resolveRepositoryRoot(cloneDir);
133
141
  } catch (gitError) {
134
- const localRoot = resolveLocalSkillRoot(packageRoot);
135
- if (localRoot) {
136
- fs.rmSync(tempRoot, { recursive: true, force: true });
137
- return {
138
- sourceRoot: localRoot,
139
- cleanup() {},
140
- };
141
- }
142
-
143
142
  const archiveMessage = archiveError instanceof Error ? archiveError.message : String(archiveError);
144
143
  const gitMessage = gitError instanceof Error ? gitError.message : String(gitError);
145
144
  throw new Error(`下载 skill 仓库失败。archive: ${archiveMessage}; git: ${gitMessage}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuanflow-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "YuanFlow API CLI and skill installer for supported AI coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,10 +9,15 @@ description: Use when the user asks about social-media API workflows, platform d
9
9
 
10
10
  ## 当前发布范围
11
11
 
12
- 当前 skill 目录只包含:
12
+ 当前 skill 目录包含:
13
13
 
14
14
  - 根目录这一份 `SKILL.md`
15
15
  - `yuanflow-cli/`
16
+ - `作品评论采集/`
17
+ - `作品详情获取工具/`
18
+ - `作品下载综合工具/`
19
+ - `综合搜索工具/`
20
+ - `综合用户搜索工具/`
16
21
 
17
22
  ## 环境判断
18
23
 
@@ -48,6 +53,66 @@ description: Use when the user asks about social-media API workflows, platform d
48
53
 
49
54
  - `yuanflow-cli`
50
55
 
56
+ ### 2. 走 `作品评论采集`
57
+
58
+ 遇到下面这些需求,优先进入这个子 Skill:
59
+
60
+ - 采集、抓取、导出或分析作品评论。
61
+ - 获取评论回复、二级评论、楼中楼、子评论。
62
+ - 用户给出抖音、小红书、B站、微信公众号、微信视频号、TikTok、Instagram、快手、Reddit、Twitter/X、微博、YouTube、知乎链接或 ID,并明确要评论数据。
63
+
64
+ 子 Skill 名称:
65
+
66
+ - `作品评论采集`
67
+
68
+ ### 3. 走 `作品详情获取工具`
69
+
70
+ 遇到下面这些需求,优先进入这个子 Skill:
71
+
72
+ - 查询单个作品、视频、笔记、文章、帖子、推文、微博、知乎文章的详情。
73
+ - 解析作品链接,获取标题、正文、作者、发布时间、互动统计、媒体信息。
74
+ - 用户给出单个作品 URL、BV 号、视频 ID、帖子 ID 或文章 ID。
75
+
76
+ 子 Skill 名称:
77
+
78
+ - `作品详情获取工具`
79
+
80
+ ### 4. 走 `作品下载综合工具`
81
+
82
+ 遇到下面这些需求,优先进入这个子 Skill:
83
+
84
+ - 获取作品播放链接、下载地址候选、视频流信息。
85
+ - 用户要求下载、保存、获取媒体地址。
86
+ - 平台包括抖音、B站、YouTube、西瓜视频。
87
+
88
+ 子 Skill 名称:
89
+
90
+ - `作品下载综合工具`
91
+
92
+ ### 5. 走 `综合搜索工具`
93
+
94
+ 遇到下面这些需求,优先进入这个子 Skill:
95
+
96
+ - 按关键词搜索内容、作品、笔记、文章、视频、帖子。
97
+ - 做选题、竞品素材、热点素材、内容检索。
98
+ - 平台包括抖音、小红书、B站、微信视频号、TikTok、Instagram、快手、Reddit、Twitter/X、微博、YouTube、知乎、西瓜视频。
99
+
100
+ 子 Skill 名称:
101
+
102
+ - `综合搜索工具`
103
+
104
+ ### 6. 走 `综合用户搜索工具`
105
+
106
+ 遇到下面这些需求,优先进入这个子 Skill:
107
+
108
+ - 搜索账号、作者、达人、用户、频道。
109
+ - 做账号调研、达人筛选、用户线索查找。
110
+ - 平台包括抖音、小红书、微信视频号、TikTok、Instagram、快手、微博、YouTube、知乎。
111
+
112
+ 子 Skill 名称:
113
+
114
+ - `综合用户搜索工具`
115
+
51
116
  ## 多需求时怎么处理
52
117
 
53
118
  如果用户一次提了多段流程,不要强行塞进一个子 Skill,按阶段拆开:
@@ -59,7 +124,7 @@ description: Use when the user asks about social-media API workflows, platform d
59
124
  例如:
60
125
 
61
126
  - “查抖音作品详情、评论、热榜”:
62
- `yuanflow-cli`
127
+ 作品详情走 `作品详情获取工具`,评论走 `作品评论采集`,热榜或其它原子接口走 `yuanflow-cli`
63
128
 
64
129
  ## 维护规则
65
130
 
@@ -5,7 +5,7 @@ description: Use when the user needs atomic API calls for social-media platforms
5
5
 
6
6
  # YuanFlow CLI
7
7
 
8
- 这个 Skill 用于调用 `yuanflow-cli` 这个 npm 包。它适合做原子级 API 调用:查作品详情、下载地址、作者主页、评论、搜索结果、热榜、公众号文章、视频号内容等。
8
+ 这个 Skill 用于调用 `yuanflow-cli` 这个 npm 包。它适合做原子级 API 调用:查作品详情、下载地址、作者主页、评论、搜索结果、热榜、公众号文章、视频号内容等。常见需求优先使用综合命令:`comments collect`、`works detail`、`works download`、`search content`、`search users`。
9
9
 
10
10
  ## 先判断是否要用
11
11
 
@@ -132,9 +132,14 @@ yuanflow-cli schema douyin.video-detail
132
132
  yuanflow-cli shortcuts
133
133
  yuanflow-cli shortcuts douyin
134
134
  yuanflow-cli list douyin
135
- yuanflow-cli commands list
136
- yuanflow-cli commands describe xiaohongshu.search-notes
137
- yuanflow-cli schema xiaohongshu.search-notes
135
+ yuanflow-cli commands list
136
+ yuanflow-cli commands describe xiaohongshu.search-notes
137
+ yuanflow-cli schema xiaohongshu.search-notes
138
+ yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
139
+ yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
140
+ yuanflow-cli works download --platform douyin --target "https://v.douyin.com/xxx/" --region CN --format agent-json
141
+ yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json
142
+ yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json
138
143
  ```
139
144
 
140
145
  当前 registry 覆盖的平台包括:
@@ -174,6 +179,65 @@ yuanflow-cli bilibili video-detail "https://www.bilibili.com/video/BVxxx" -o bil
174
179
  | 作品评论 | `yuanflow-cli douyin comments <aweme_id> --count 20 --cursor 0 --format agent-json` |
175
180
  | 抖音热榜 | `yuanflow-cli douyin hot-search --format agent-json` |
176
181
 
182
+ ### 作品评论采集统一入口
183
+
184
+ 评论采集优先使用统一入口:
185
+
186
+ ```powershell
187
+ yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
188
+ ```
189
+
190
+ 常用参数:
191
+
192
+ - `--platform`:平台,如 `douyin`、`xiaohongshu`、`bilibili`、`wechat_mp`、`wechat_channels`、`tiktok`、`instagram`、`kuaishou`、`reddit`、`twitter`、`weibo`、`youtube`、`zhihu`。
193
+ - `--action`:`comments` 一级评论,`replies` 评论回复;YouTube 社区帖子使用 `post_comments` 或 `post_replies`。
194
+ - `--target`:作品链接、文章链接、视频 ID、笔记 ID、BV 号等。
195
+ - `--comment-id`:采集回复时的父评论 ID。
196
+ - `--cursor`:翻页游标。
197
+ - `--count`:返回数量。
198
+ - `--page`:B站页码。
199
+ - `--prefer fallback`:主接口失败时切换备用接口。
200
+ - `--extra`:JSON 字符串,用于公众号 `content_id` 等补充参数。
201
+
202
+ 在 YuanFlow 主程序内,用 `yuanflow_cli_call` 调用时传参数数组:
203
+
204
+ ```json
205
+ {
206
+ "args": [
207
+ "comments",
208
+ "collect",
209
+ "--platform",
210
+ "douyin",
211
+ "--target",
212
+ "https://v.douyin.com/xxx/",
213
+ "--format",
214
+ "agent-json"
215
+ ]
216
+ }
217
+ ```
218
+
219
+ ### 综合作品与搜索入口
220
+
221
+ 新增综合入口优先给 Agent 使用:
222
+
223
+ | 需求 | 命令 |
224
+ | --- | --- |
225
+ | 单作品详情 | `yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json` |
226
+ | 播放/下载地址候选 | `yuanflow-cli works download --platform douyin --target "https://v.douyin.com/xxx/" --region CN --format agent-json` |
227
+ | 内容综合搜索 | `yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json` |
228
+ | 用户/账号搜索 | `yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json` |
229
+
230
+ 对应 schema:
231
+
232
+ ```powershell
233
+ yuanflow-cli schema works.douyin.detail
234
+ yuanflow-cli schema works.youtube.download
235
+ yuanflow-cli schema search.xiaohongshu.content
236
+ yuanflow-cli schema search.instagram.users
237
+ ```
238
+
239
+ YuanFlow 主程序内使用时仍通过 `yuanflow_cli_call` 传参数数组,token 由主程序注入。
240
+
177
241
  ### 小红书
178
242
 
179
243
  | 需求 | 命令 |
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: 作品下载综合工具
3
+ description: Use when the user wants to get playable media streams, download URL candidates, or save-ready media metadata for Douyin, Bilibili, YouTube, or Xigua works through yuanflow-cli.
4
+ builtin_skill_version: 1.0.0
5
+ tags:
6
+ - 自媒体
7
+ - 作品下载
8
+ - 播放链接
9
+ - 抖音
10
+ - B站
11
+ - YouTube
12
+ - 西瓜视频
13
+ emoji: ⬇️
14
+ ---
15
+
16
+ # 作品下载综合工具
17
+
18
+ 本技能把用户的“下载作品、获取播放地址、获取视频流信息”需求稳定映射到 `yuanflow-cli works download`。在 YuanFlow 主程序内,优先调用受控工具 `yuanflow_cli_call`;它会由主程序认证系统注入 `YUANCHUANG_API_TOKEN`,不要让用户粘贴 KEY,不要在回复、日志或文件里暴露 token。
19
+
20
+ ## 什么时候使用
21
+
22
+ 用户出现以下意图时使用:
23
+
24
+ - 下载、保存、获取播放链接、获取视频流、获取媒体地址。
25
+ - 用户给出抖音、B站、YouTube、西瓜视频链接或作品 ID。
26
+ - 用户只想先确认作品是否有可用播放/下载地址。
27
+
28
+ 不要用于批量抓取、绕过平台限制、破解权限、去除平台风控、下载私密或未授权内容。该工具只返回上游接口提供的播放/下载地址候选或视频流信息;真正保存到本地文件如需后续执行,必须先确认用户授权和保存路径。
29
+
30
+ ## 调用优先级
31
+
32
+ 1. YuanFlow 主程序内:调用 `yuanflow_cli_call`,参数数组从 `works download` 开始。
33
+ 2. 外部 Agent 且本机有 CLI:执行 `yuanflow-cli works download ...`。
34
+ 3. 外部 Agent 且没有 CLI:再提示用户安装 `npm install -g yuanflow-cli`。
35
+
36
+ YuanFlow 内置调用示例:
37
+
38
+ ```json
39
+ {
40
+ "args": [
41
+ "works",
42
+ "download",
43
+ "--platform",
44
+ "douyin",
45
+ "--target",
46
+ "https://v.douyin.com/xxx/",
47
+ "--region",
48
+ "CN",
49
+ "--format",
50
+ "agent-json"
51
+ ]
52
+ }
53
+ ```
54
+
55
+ 外部 CLI 示例:
56
+
57
+ ```powershell
58
+ yuanflow-cli works download --platform douyin --target "https://v.douyin.com/xxx/" --region CN --format agent-json
59
+ ```
60
+
61
+ ## 先查命令和 schema
62
+
63
+ 不确定参数时先查,不要猜:
64
+
65
+ ```json
66
+ {"args":["commands","list"]}
67
+ {"args":["schema","works.douyin.download"]}
68
+ {"args":["schema","works.youtube.download"]}
69
+ ```
70
+
71
+ 命令 key 格式是:
72
+
73
+ ```text
74
+ works.<platform>.download
75
+ ```
76
+
77
+ ## 平台识别
78
+
79
+ | 平台参数 | 用户常见说法 | 链接或 ID 标识 | 说明 |
80
+ |---|---|---|---|
81
+ | `douyin` | 抖音、Douyin | `douyin.com`、`iesdouyin.com`、`v.douyin.com`、`aweme_id` | 支持分享链接或 aweme_id,可传 `--region CN` |
82
+ | `bilibili` | B站、哔哩哔哩 | `bilibili.com`、`b23.tv`、`BV` 号 | URL 走播放信息;BV + `--cid` 可取 playurl |
83
+ | `youtube` | YouTube、油管 | `youtube.com/watch?v=`、`youtu.be/`、视频 ID | 默认获取 streams;签名流 URL 需要 `--prefer signed --itag` |
84
+ | `xigua` | 西瓜视频 | 西瓜视频链接、`item_id` | 使用 `item_id` 获取播放链接 |
85
+
86
+ 如果短链文本无法判断平台,先按域名判断;仍无法判断就追问平台。
87
+
88
+ ## 参数规则
89
+
90
+ 通用参数:
91
+
92
+ - `--platform`:平台标识。
93
+ - `--target`:作品链接、分享链接或作品 ID。
94
+ - `--prefer`:默认 `primary`;YouTube 需要签名流时用 `signed`;有备用接口时可用 `fallback`。
95
+ - `--region`:抖音可选,国内用户通常传 `CN`。
96
+ - `--cid`:B站按 BV 号取 playurl 时必填。
97
+ - `--itag`:YouTube 获取签名流 URL 时必填,来自 `get_video_streams` 的返回。
98
+ - `--extra`:JSON 字符串补充参数。
99
+ - `--format agent-json`:Agent 调用时必须加,便于稳定解析。
100
+
101
+ ## 接口映射
102
+
103
+ | 平台 | 首选能力 | 主要参数 | 备用或特殊能力 |
104
+ |---|---|---|---|
105
+ | 抖音 | 最高画质播放/下载地址查询 | `share_url` 或 `aweme_id`、`region` | 支持 web 备用接口 |
106
+ | B站 | 视频播放信息 | `url` | `bv_id` + `cid` 获取视频流地址 |
107
+ | YouTube | 视频流信息 | `video_id` 或 `video_url` | `--prefer signed --itag` 获取签名流 URL |
108
+ | 西瓜视频 | 视频播放链接 | `item_id` | 暂无备用 |
109
+
110
+ ## 输出要求
111
+
112
+ 成功后用中文简短说明:
113
+
114
+ - 调用了哪个平台和下载/播放能力。
115
+ - 返回的是播放信息、下载地址候选还是视频流信息。
116
+ - 如果响应里有多清晰度、itag、签名 URL、下一步保存所需字段,要提示用户。
117
+
118
+ 失败时按 `agent-json` 的 `error.code` 和 `error.message` 解释。不要展示完整 Authorization 请求头、token、cookie 或敏感账号信息。
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: 作品评论采集
3
+ description: Use when the user needs to collect, export, inspect, or continue comment and reply data for Douyin, Xiaohongshu, Bilibili, WeChat MP, WeChat Channels, TikTok, Instagram, Kuaishou, Reddit, Twitter/X, Weibo, YouTube, or Zhihu posts.
4
+ builtin_skill_version: 1.0.0
5
+ tags:
6
+ - 自媒体
7
+ - 评论采集
8
+ - 抖音
9
+ - 小红书
10
+ - B站
11
+ - 微信公众号
12
+ - 微信视频号
13
+ - TikTok
14
+ - Instagram
15
+ - 快手
16
+ - Reddit
17
+ - Twitter
18
+ - 微博
19
+ - YouTube
20
+ - 知乎
21
+ emoji: 💬
22
+ ---
23
+
24
+ # 作品评论采集
25
+
26
+ 本技能把用户的评论采集需求稳定映射到 `yuanflow-cli comments collect`。在 YuanFlow 主程序内,优先使用受控工具 `yuanflow_cli_call`;它会由主程序认证系统注入 `YUANCHUANG_API_TOKEN`,不要让用户粘贴 KEY,不要在回复、日志或文件里暴露 token。
27
+
28
+ ## 什么时候使用
29
+
30
+ 用户出现以下意图时使用:
31
+
32
+ - 采集、抓取、获取、导出某个作品、文章、帖子、回答的评论。
33
+ - 获取某条评论下的回复、二级评论、楼中楼、子评论。
34
+ - 用户给出抖音、小红书、B站、微信公众号文章、微信视频号、TikTok、Instagram、快手、Reddit、Twitter/X、微博、YouTube、知乎链接或 ID,并要求看评论数据。
35
+
36
+ 不要用于发评论、回复评论、点赞评论、绕过平台限制、批量抓取或未授权数据访问。作品详情、作品下载、用户主页、综合搜索应交给 `yuanflow-cli` 其它命令。
37
+
38
+ ## 调用优先级
39
+
40
+ 1. YuanFlow 主程序内:调用 `yuanflow_cli_call`,参数数组从 `comments collect` 开始。
41
+ 2. 外部 Agent 且本机有 CLI:执行 `yuanflow-cli comments collect ...`。
42
+ 3. 外部 Agent 且没有 CLI:再提示用户安装 `npm install -g yuanflow-cli`。
43
+
44
+ YuanFlow 内置调用示例:
45
+
46
+ ```json
47
+ {
48
+ "args": [
49
+ "comments",
50
+ "collect",
51
+ "--platform",
52
+ "douyin",
53
+ "--target",
54
+ "https://v.douyin.com/xxx/",
55
+ "--format",
56
+ "agent-json"
57
+ ]
58
+ }
59
+ ```
60
+
61
+ 外部 CLI 示例:
62
+
63
+ ```powershell
64
+ yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
65
+ ```
66
+
67
+ ## 先查命令和 schema
68
+
69
+ 不确定参数时先查,不要猜:
70
+
71
+ ```json
72
+ {"args":["commands","list"]}
73
+ {"args":["schema","comments.douyin.comments"]}
74
+ ```
75
+
76
+ 命令 key 格式是:
77
+
78
+ ```text
79
+ comments.<platform>.<action>
80
+ ```
81
+
82
+ 例如 `comments.douyin.comments`、`comments.xiaohongshu.replies`、`comments.youtube.post_comments`。
83
+
84
+ ## 参数规则
85
+
86
+ 通用参数:
87
+
88
+ - `--platform`:平台标识。
89
+ - `--action`:`comments` 一级评论;`replies` 评论回复;YouTube 社区帖子用 `post_comments` 或 `post_replies`。默认 `comments`。
90
+ - `--target`:作品、文章、帖子或回答 ID,也可以传支持的平台链接。
91
+ - `--comment-id`:多数平台采集回复时必填。
92
+ - `--cursor`:翻页游标,必须来自上一次响应,不要编造。
93
+ - `--count`:返回数量,仅平台支持时传。
94
+ - `--page`:B站页码。
95
+ - `--prefer fallback`:主接口失败或用户要求备用接口时使用。
96
+ - `--extra`:JSON 字符串补充参数,例如微信公众号回复需要 `content_id`。
97
+ - `--format agent-json`:Agent 调用时必须加,便于稳定解析。
98
+
99
+ ## 平台识别
100
+
101
+ | 平台参数 | 用户常见说法 | 链接或 ID 标识 |
102
+ |---|---|---|
103
+ | `douyin` | 抖音、Douyin | `douyin.com`、`iesdouyin.com`、`v.douyin.com`、`aweme_id` |
104
+ | `xiaohongshu` | 小红书、XHS | `xiaohongshu.com`、`xhslink.com`、`note_id` |
105
+ | `bilibili` | B站、哔哩哔哩 | `bilibili.com`、`b23.tv`、`BV` 号 |
106
+ | `wechat_mp` | 微信公众号、公众号文章 | `mp.weixin.qq.com/s/` |
107
+ | `wechat_channels` | 微信视频号、视频号 | 视频号视频 ID、视频号详情里的 `id` |
108
+ | `tiktok` | TikTok | `tiktok.com`、`vm.tiktok.com`、`aweme_id` |
109
+ | `instagram` | Instagram、ins | `instagram.com/p/`、`instagram.com/reel/`、shortcode、media_id |
110
+ | `kuaishou` | 快手 | `kuaishou.com/short-video/`、`photo_id` |
111
+ | `reddit` | Reddit | `reddit.com/r/.../comments/`、`t3_` 帖子 ID |
112
+ | `twitter` | Twitter、X | `twitter.com`、`x.com`、推文数字 ID |
113
+ | `weibo` | 微博 | `weibo.com`、微博 `id`、`mid` |
114
+ | `youtube` | YouTube、油管 | `youtube.com/watch?v=`、`youtu.be/`、视频 ID、社区帖子 ID |
115
+ | `zhihu` | 知乎 | 知乎回答 ID、评论 ID |
116
+
117
+ 如果短链文本无法判断平台,先按域名判断;仍无法判断就追问平台。
118
+
119
+ ## 接口映射
120
+
121
+ Agent 不需要直接拼接口地址,只需要选对 `platform`、`action` 和参数。
122
+
123
+ | 平台 | action | 首选能力 | 主要参数 | 备用能力 |
124
+ |---|---|---|---|---|
125
+ | 抖音 | `comments` | 抖音作品一级评论 | `aweme_id`、`cursor`、`count` | 支持 |
126
+ | 抖音 | `replies` | 抖音评论回复 | `item_id`、`comment_id`、`cursor`、`count` | 支持 |
127
+ | 小红书 | `comments` | 小红书笔记一级评论 | `note_id`、`cursor` | 支持 |
128
+ | 小红书 | `replies` | 小红书笔记二级评论 | `note_id`、`comment_id`、`cursor`、`count` | 支持 |
129
+ | B站 | `comments` | B站视频一级评论 | `bv_id`、`page` | 支持 |
130
+ | B站 | `replies` | B站评论回复 | `bv_id`、`comment_id`、`page` | 暂无 |
131
+ | 微信公众号 | `comments` | 公众号文章一级评论 | `url`、`comment_id`、`cursor` | 暂无 |
132
+ | 微信公众号 | `replies` | 公众号文章评论回复 | `url`、`comment_id`、`extra.content_id`、`cursor` | 暂无 |
133
+ | 微信视频号 | `comments` | 视频号一级评论 | `id`、`cursor` | 暂无 |
134
+ | 微信视频号 | `replies` | 视频号评论回复 | `id`、`comment_id`、`cursor` | 暂无 |
135
+ | TikTok | `comments` | TikTok 作品一级评论 | `aweme_id`、`cursor`、`count` | 支持 |
136
+ | TikTok | `replies` | TikTok 评论回复 | `item_id`、`comment_id`、`cursor`、`count` | 支持 |
137
+ | Instagram | `comments` | Instagram 帖子一级评论 | `code_or_url`、`cursor` | 支持 |
138
+ | Instagram | `replies` | Instagram 评论回复 | `code_or_url`、`comment_id`、`cursor` | 支持 |
139
+ | 快手 | `comments` | 快手作品一级评论 | `photo_id`、`cursor` | 支持 |
140
+ | 快手 | `replies` | 快手作品二级评论 | `photo_id`、`comment_id`、`cursor` | 暂无 |
141
+ | Reddit | `comments` | Reddit 帖子一级评论 | `post_id`、`cursor` | 暂无 |
142
+ | Reddit | `replies` | Reddit 评论回复 | `post_id`、`cursor` | 暂无 |
143
+ | Twitter/X | `comments` | 推文评论 | `tweet_id`、`cursor` | 支持 |
144
+ | 微博 | `comments` | 微博一级评论 | `id`、`count`、`cursor` | 支持 |
145
+ | 微博 | `replies` | 微博子评论 | `id`、`count`、`cursor` | 暂无 |
146
+ | YouTube | `comments` | 视频一级评论 | `video_id`、`cursor` | 支持 |
147
+ | YouTube | `replies` | 视频二级评论 | `continuation_token` | 支持 |
148
+ | YouTube | `post_comments` | 社区帖子一级评论 | `post_id`、`cursor` | 暂无 |
149
+ | YouTube | `post_replies` | 社区帖子评论回复 | `continuation_token` | 暂无 |
150
+ | 知乎 | `comments` | 回答评论区 | `answer_id`、`count`、`cursor` | 暂无 |
151
+ | 知乎 | `replies` | 子评论区 | `comment_id`、`count`、`cursor` | 暂无 |
152
+
153
+ ## 输出要求
154
+
155
+ 成功后用中文简短说明:
156
+
157
+ - 调用了哪个平台和评论类型。
158
+ - 使用首选能力还是备用能力。
159
+ - 如果响应里有评论数量、下一页游标或 continuation token,要提示用户。
160
+ - 用户要求导出时,再整理为表格、JSON 或文件。
161
+
162
+ 失败时按 `agent-json` 的 `error.code` 和 `error.message` 解释。常见处理:
163
+
164
+ - `TOKEN_MISSING`:提示先完成 YuanFlow KEY 认证或外部 CLI 环境变量配置。
165
+ - `BAD_ARGUMENT`:检查平台、action、target、comment-id、cursor。
166
+ - `AUTH_INVALID`:认证无效或权限不足。
167
+ - `UPSTREAM_ERROR`、`NETWORK_ERROR`:说明上游或网络失败,可稍后重试,或在有备用能力的平台加 `--prefer fallback`。
168
+
169
+ 不要展示完整 Authorization 请求头、token、cookie 或敏感账号信息。