aiconductor-cli 1.5.1 → 1.7.0

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.
Files changed (92) hide show
  1. package/README.md +565 -419
  2. package/bin/aiconductor-cli.js +401 -296
  3. package/package.json +1 -1
  4. package/src/api.js +361 -2
  5. package/src/api.test.js +553 -3
  6. package/src/commands/content.js +184 -184
  7. package/src/commands/douyin.js +174 -0
  8. package/src/commands/html_publish.js +54 -54
  9. package/src/commands/md_publish.js +175 -175
  10. package/src/commands/web.js +69 -0
  11. package/src/commands/web_search.js +99 -99
  12. package/src/commands/wx.js +116 -116
  13. package/src/commands/xhs.js +763 -268
  14. package/src/lib/cli-utils.js +172 -84
  15. package/src/lib/daren-score.js +91 -0
  16. package/src/lib/daren-score.test.js +57 -0
  17. package/AGENTS.md +0 -189
  18. package/api_docs/aic_web_search.md +0 -84
  19. package/api_docs/audio_converter.md +0 -51
  20. package/api_docs/balance_query.md +0 -38
  21. package/api_docs/bing_search.md +0 -55
  22. package/api_docs/china_stock_data.md +0 -221
  23. package/api_docs/delete_published_webpage.md +0 -38
  24. package/api_docs/doubao_search.md +0 -80
  25. package/api_docs/douyin_link_to_text_v1.md +0 -50
  26. package/api_docs/douyin_link_to_text_v2.md +0 -50
  27. package/api_docs/douyin_user_detail.md +0 -65
  28. package/api_docs/douyin_user_search.md +0 -58
  29. package/api_docs/douyin_user_videos.md +0 -49
  30. package/api_docs/douyin_user_videos_async.md +0 -45
  31. package/api_docs/douyin_user_videos_async_query.md +0 -41
  32. package/api_docs/douyin_user_videos_max.md +0 -59
  33. package/api_docs/douyin_video_comments.md +0 -68
  34. package/api_docs/douyin_video_info.md +0 -70
  35. package/api_docs/douyin_video_search.md +0 -60
  36. package/api_docs/douyin_video_search_fast.md +0 -48
  37. package/api_docs/fast_ocr.md +0 -51
  38. package/api_docs/flow_article2podcast_creat.md +0 -41
  39. package/api_docs/flow_article2podcast_query.md +0 -41
  40. package/api_docs/flow_wx_history_articles.md +0 -45
  41. package/api_docs/generate_image.md +0 -68
  42. package/api_docs/get_duration.md +0 -37
  43. package/api_docs/hot_list_mixed.md +0 -122
  44. package/api_docs/html_publish.md +0 -50
  45. package/api_docs/html_publish_flexible.md +0 -65
  46. package/api_docs/image_resize.md +0 -58
  47. package/api_docs/image_to_permalink.md +0 -61
  48. package/api_docs/link_expander.md +0 -39
  49. package/api_docs/llm_proxy.md +0 -61
  50. package/api_docs/markitdown.md +0 -47
  51. package/api_docs/md_to_docx.md +0 -51
  52. package/api_docs/md_to_html.md +0 -53
  53. package/api_docs/md_to_mindmap.md +0 -52
  54. package/api_docs/md_to_pdf.md +0 -52
  55. package/api_docs/md_to_png.md +0 -53
  56. package/api_docs/md_to_txt.md +0 -51
  57. package/api_docs/md_to_wxhtml.md +0 -64
  58. package/api_docs/md_to_xhs.md +0 -87
  59. package/api_docs/md_to_xlsx.md +0 -52
  60. package/api_docs/portrait_enhancement.md +0 -69
  61. package/api_docs/published_webpages.md +0 -45
  62. package/api_docs/r2_uploader.md +0 -51
  63. package/api_docs/schedulerx_job_create.md +0 -56
  64. package/api_docs/transaction_query.md +0 -52
  65. package/api_docs/url_to_markdown.md +0 -50
  66. package/api_docs/video_download_url.md +0 -57
  67. package/api_docs/video_download_url_oss.md +0 -55
  68. package/api_docs/video_to_text.md +0 -48
  69. package/api_docs/video_to_text_v2.md +0 -49
  70. package/api_docs/volcengine_face_pretty.md +0 -55
  71. package/api_docs/volcengine_faceswap.md +0 -55
  72. package/api_docs/website_screenshot.md +0 -49
  73. package/api_docs/wx_access_token.md +0 -44
  74. package/api_docs/wx_article_analysis_data_push.md +0 -43
  75. package/api_docs/wx_article_data.md +0 -48
  76. package/api_docs/wx_article_style_rewrite.md +0 -45
  77. package/api_docs/wx_draft_add.md +0 -56
  78. package/api_docs/wx_draft_publish.md +0 -47
  79. package/api_docs/wx_history_articles.md +0 -89
  80. package/api_docs/wx_image_upload.md +0 -46
  81. package/api_docs/wx_md_to_html.md +0 -48
  82. package/api_docs/wx_rss_reader.md +0 -59
  83. package/api_docs/xhs_hot_list.md +0 -48
  84. package/api_docs/xhs_note_comments_fast.md +0 -54
  85. package/api_docs/xhs_note_info_v2.md +0 -45
  86. package/api_docs/xhs_note_info_v3.md +0 -69
  87. package/api_docs/xhs_note_publish.md +0 -54
  88. package/api_docs/xhs_note_search_v2.md +0 -73
  89. package/api_docs/xhs_note_search_v3.md +0 -54
  90. package/api_docs/xhs_user_info_v2.md +0 -61
  91. package/api_docs/xhs_user_notes_v2.md +0 -56
  92. package/api_docs/xhs_user_notes_v3.md +0 -48
@@ -1,296 +1,401 @@
1
- #!/usr/bin/env node
2
-
3
- const { Command } = require("commander");
4
- const { publishCommand } = require("../src/commands/html_publish");
5
- const {
6
- publishCommand: webpagePublishCommand,
7
- listCommand: webpageListCommand,
8
- deleteCommand: webpageDeleteCommand,
9
- } = require("../src/commands/md_publish");
10
- const { searchCommand } = require("../src/commands/web_search");
11
- const { briefingCommand } = require("../src/commands/content");
12
- const {
13
- videoInfoCommand,
14
- videoCommentsCommand,
15
- userVideosCommand,
16
- userDetailCommand,
17
- userSearchCommand,
18
- videoSearchCommand,
19
- linkToTextCommand,
20
- } = require("../src/commands/douyin");
21
- const { hotListCommand: xhsHotListCommand, notePublishCommand } = require("../src/commands/xhs");
22
- const {
23
- articleDataCommand: wxArticleDataCommand,
24
- historyCommand: wxHistoryCommand,
25
- } = require("../src/commands/wx");
26
-
27
- const program = new Command();
28
-
29
- function collect(value, previous) {
30
- return previous ? previous.concat([value]) : [value];
31
- }
32
-
33
- program
34
- .name("aiconductor-cli")
35
- .description("AIConductor CLI 工具箱")
36
- .version(require("../package.json").version);
37
-
38
- // html 子命令组
39
- const htmlCmd = program
40
- .command("html")
41
- .description("HTML 相关操作");
42
-
43
- htmlCmd
44
- .command("publish")
45
- .description("发布 HTML 代码为在线网页")
46
- .argument("<html>", "HTML 代码字符串或 HTML 文件路径")
47
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
48
- .option("-t, --title <title>", "文档标题(用作文件名基础)")
49
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
50
- .action((html, options) => {
51
- publishCommand(html, options);
52
- });
53
-
54
- // webpage 子命令组(统一发布 Markdown/HTML 为在线网页)
55
- const webpageCmd = program
56
- .command("webpage")
57
- .description("网页发布(支持 Markdown 和 HTML)");
58
-
59
- webpageCmd
60
- .command("publish")
61
- .description("将 Markdown 或 HTML 发布为在线网页(自动识别类型)")
62
- .argument("<input>", "Markdown/HTML 文本字符串或文件路径")
63
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
64
- .option("-t, --title <title>", "文件名(不含 .html 后缀)")
65
- .option("--type <type>", "强制指定类型:md 或 html(默认自动识别)")
66
- .option("--copy-button", "添加代码复制按钮(仅 Markdown 类型生效)")
67
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
68
- .action((input, options) => {
69
- webpagePublishCommand(input, options);
70
- });
71
-
72
- webpageCmd
73
- .command("list")
74
- .description("查询当前用户已发布的网页")
75
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
76
- .option("--page <page>", "页码,最小为 1", "1")
77
- .option("--page-size <size>", "每页条数,范围为 1 到 100", "20")
78
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
79
- .action((options) => {
80
- webpageListCommand(options);
81
- });
82
-
83
- webpageCmd
84
- .command("delete")
85
- .description("删除当前用户指定的已发布网页")
86
- .argument("<webpage_id>", "网页记录 ID,可通过 webpage list 获取")
87
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
88
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
89
- .action((webpageId, options) => {
90
- webpageDeleteCommand(webpageId, options);
91
- });
92
-
93
- // search 子命令组
94
- const searchCmd = program
95
- .command("search")
96
- .description("网页/图片搜索");
97
-
98
- searchCmd
99
- .command("web")
100
- .description("网页搜索")
101
- .argument("<query>", "搜索关键词(1~100字符)")
102
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
103
- .option("-n, --count <n>", "返回条数(最多50)")
104
- .option("--time-range <range>", "时间范围:OneDay/OneWeek/OneMonth/OneYear 或 YYYY-MM-DD..YYYY-MM-DD")
105
- .option("--need-content", "仅返回包含正文的结果")
106
- .option("--need-url", "仅返回带原文链接的结果")
107
- .option("--sites <domains>", "限定搜索站点,完整域名以 | 分隔,最多20个")
108
- .option("--block-hosts <domains>", "屏蔽站点,完整域名以 | 分隔,最多5个")
109
- .option("--auth-info-level <level>", "权威度过滤:0=不限制,1=仅非常权威内容")
110
- .option("--auth-level <level>", "兼容别名,等同 --auth-info-level")
111
- .option("--content-format <format>", "正文格式:text 或 markdown", "text")
112
- .option("--industry <type>", "行业搜索:finance、game 或 gov")
113
- .option("--query-rewrite", "开启 Query 改写")
114
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
115
- .action((query, options) => {
116
- searchCommand(query, "web", options);
117
- });
118
-
119
- searchCmd
120
- .command("image")
121
- .description("图片搜索")
122
- .argument("<query>", "搜索关键词(1~100字符)")
123
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
124
- .option("-n, --count <n>", "返回条数(最多5)")
125
- .option("--image-width-min <px>", "图片最小宽度")
126
- .option("--image-width-max <px>", "图片最大宽度")
127
- .option("--image-height-min <px>", "图片最小高度")
128
- .option("--image-height-max <px>", "图片最大高度")
129
- .option("--image-shapes <shapes>", "图片形状,以 | 分隔:横长方形、竖长方形、方形")
130
- .option("--query-rewrite", "开启 Query 改写")
131
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
132
- .action((query, options) => {
133
- searchCommand(query, "image", options);
134
- });
135
-
136
- // content 子命令组
137
- const contentCmd = program
138
- .command("content")
139
- .description("内容选题与素材工具");
140
-
141
- contentCmd
142
- .command("briefing")
143
- .description("聚合多平台热点与小红书热榜,生成选题原料")
144
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
145
- .option("--sources <ids>", "来源 ID,逗号分隔;默认 zhihu,weibo,douyin,aihot")
146
- .option("--limit <n>", "每个来源返回条数,范围 1 到 30", "30")
147
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
148
- .action((options) => {
149
- briefingCommand(options);
150
- });
151
-
152
- // 未知命令处理
153
-
154
- // douyin 子命令组
155
- const douyinCmd = program
156
- .command("douyin")
157
- .description("抖音数据工具箱");
158
-
159
- douyinCmd
160
- .command("video-info")
161
- .description("获取抖音作品详情(0.01元/次)")
162
- .argument("<share_url>", "抖音视频分享链接")
163
- .option("-k, --api-key <key>", "AIConductor API Key")
164
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
165
- .action((shareUrl, options) => { videoInfoCommand(shareUrl, options); });
166
-
167
- douyinCmd
168
- .command("video-comments")
169
- .description("获取抖音作品评论(0.01元/次)")
170
- .argument("<video_url>", "抖音视频URL")
171
- .option("-k, --api-key <key>", "AIConductor API Key")
172
- .option("--max-count <n>", "获取评论数量", "50")
173
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
174
- .action((videoUrl, options) => { videoCommentsCommand(videoUrl, options); });
175
-
176
- douyinCmd
177
- .command("user-videos")
178
- .description("获取抖音用户视频列表(0.03元/页)")
179
- .argument("<home_page>", "抖音用户主页URL")
180
- .option("-k, --api-key <key>", "AIConductor API Key")
181
- .option("--max-pages <n>", "最大页数", "1")
182
- .option("--max-seconds <n>", "最长运行时间(秒),最大180", "50")
183
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
184
- .action((homePage, options) => { userVideosCommand(homePage, options); });
185
-
186
- douyinCmd
187
- .command("user-detail")
188
- .description("获取抖音用户详情(0.03元/次)")
189
- .argument("<home_page>", "抖音用户主页URL")
190
- .option("-k, --api-key <key>", "AIConductor API Key")
191
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
192
- .action((homePage, options) => { userDetailCommand(homePage, options); });
193
-
194
- douyinCmd
195
- .command("user-search")
196
- .description("搜索抖音用户(0.15元/页)")
197
- .argument("<keyword>", "搜索关键词")
198
- .option("-k, --api-key <key>", "AIConductor API Key")
199
- .option("--max-pages <n>", "最大页数,0=不限制", "1")
200
- .option("--max-seconds <n>", "最长运行时间(秒),最大180", "50")
201
- .option("--fans-range <range>", "粉丝数量筛选:0_1k/1k_1w/1w_10w/10w_100w/100w_")
202
- .option("--user-type <type>", "用户类型筛选:common_user/enterprise_user/personal_user")
203
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
204
- .action((keyword, options) => { userSearchCommand(keyword, options); });
205
-
206
- douyinCmd
207
- .command("video-search")
208
- .description("搜索抖音视频(0.15元/页)")
209
- .argument("<keyword>", "搜索关键词")
210
- .option("-k, --api-key <key>", "AIConductor API Key")
211
- .option("--max-pages <n>", "最大页数,0=不限制", "1")
212
- .option("--max-seconds <n>", "最长运行时间(秒),最大50", "50")
213
- .option("--sort-type <type>", "排序方式:0=综合,1=最多点赞,2=最新发布", "0")
214
- .option("--publish-time <time>", "发布时间:0=不限,1=一天,7=一周,180=半年", "0")
215
- .option("--filter-duration <dur>", "视频时长:0=不限,0-1=1分钟内,1-5=1-5分钟,5-10000=5分钟以上", "0")
216
- .option("--content-type <type>", "内容类型:0=不限,1=视频,2=图片,3=文章", "0")
217
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
218
- .action((keyword, options) => { videoSearchCommand(keyword, options); });
219
-
220
- douyinCmd
221
- .command("link-to-text")
222
- .description("抖音作品链接转文字(0.01元/次 + 0.0003元/秒)")
223
- .argument("<video_url>", "抖音视频URL")
224
- .option("-k, --api-key <key>", "AIConductor API Key")
225
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
226
- .action((videoUrl, options) => { linkToTextCommand(videoUrl, options); });
227
-
228
- // xhs 子命令组
229
- const xhsCmd = program
230
- .command("xhs")
231
- .description("小红书数据工具箱");
232
-
233
- xhsCmd
234
- .command("hot-list")
235
- .description("获取小红书实时热榜")
236
- .option("-k, --api-key <key>", "AIConductor API Key")
237
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
238
- .action((options) => { xhsHotListCommand(options); });
239
-
240
- xhsCmd
241
- .command("note-publish")
242
- .description("生成小红书扫码发布页与二维码(0.05元/次)")
243
- .argument("<type>", "笔记类型:normal(图文)或 video(视频)")
244
- .option("-k, --api-key <key>", "AIConductor API Key")
245
- .option("-t, --title <title>", "笔记标题(最多20字符)")
246
- .option("--content <text>", "笔记正文(最多1000字符)")
247
- .option("--images <urls>", "图片公网URL列表,逗号分隔(normal类型,最多18张)")
248
- .option("--image-file <path>", "本地图片路径,可重复使用(normal类型,最多18张)", collect)
249
- .option("--image-base64 <data>", "图片Base64/data URL/@文本文件,可重复使用", collect)
250
- .option("--video <url>", "视频公网URL(与--video-file、--video-base64三选一)")
251
- .option("--video-file <path>", "本地视频路径(与--video、--video-base64三选一)")
252
- .option("--video-base64 <data>", "视频Base64/data URL/@文本文件(与其他视频来源三选一)")
253
- .option("--cover <url>", "视频封面图公网URL(与其他封面来源三选一)")
254
- .option("--cover-file <path>", "本地视频封面路径(仅video类型有效)")
255
- .option("--cover-base64 <data>", "视频封面Base64/data URL/@文本文件(仅video类型)")
256
- .option("--upload-valid-days <days>", "本地/Base64素材临时链接有效期:1或7天", "7")
257
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
258
- .action((type, options) => { notePublishCommand(type, options); });
259
-
260
- // wx 子命令组(公众号数据)
261
- const wxCmd = program
262
- .command("wx")
263
- .description("微信公众号数据工具箱");
264
-
265
- wxCmd
266
- .command("article-data")
267
- .description("获取公众号文章互动数据(按次计费)")
268
- .argument("<url>", "微信文章链接")
269
- .option("-k, --api-key <key>", "AIConductor API Key")
270
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
271
- .action((url, options) => { wxArticleDataCommand(url, options); });
272
-
273
- wxCmd
274
- .command("history")
275
- .description("获取公众号历史文章列表(按成功翻页次数计费)")
276
- .argument("[url]", "微信文章链接(用于定位公众号)")
277
- .option("-k, --api-key <key>", "AIConductor API Key")
278
- .option("--name <name>", "公众号名称或微信 ID(与 url 至少提供一个)")
279
- .option("--max-pages <n>", "最大翻页数量", "1")
280
- .option("--max-seconds <n>", "最长运行时间(秒),最大 170", "50")
281
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
282
- .action((url, options) => { wxHistoryCommand(url, options); });
283
-
284
- // 未知命令处理
285
- program.on("command:*", () => {
286
- console.error(`未知命令: ${program.args.join(" ")}`);
287
- console.error("使用 --help 查看可用命令。");
288
- process.exit(1);
289
- });
290
-
291
- program.parse(process.argv);
292
-
293
- // 没有参数时显示帮助
294
- if (!process.argv.slice(2).length) {
295
- program.outputHelp();
296
- }
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require("commander");
4
+ const { publishCommand } = require("../src/commands/html_publish");
5
+ const {
6
+ publishCommand: webpagePublishCommand,
7
+ listCommand: webpageListCommand,
8
+ deleteCommand: webpageDeleteCommand,
9
+ } = require("../src/commands/md_publish");
10
+ const { searchCommand } = require("../src/commands/web_search");
11
+ const { toMdCommand } = require("../src/commands/web");
12
+ const { briefingCommand } = require("../src/commands/content");
13
+ const {
14
+ videoInfoCommand,
15
+ videoCommentsCommand,
16
+ userVideosCommand,
17
+ userDetailCommand,
18
+ userSearchCommand,
19
+ videoSearchCommand,
20
+ linkToTextCommand,
21
+ topicRadarCommand,
22
+ videoOriginalCommand,
23
+ } = require("../src/commands/douyin");
24
+ const {
25
+ hotListCommand: xhsHotListCommand,
26
+ notePublishCommand,
27
+ noteCommand: xhsNoteCommand,
28
+ commentsCommand: xhsCommentsCommand,
29
+ searchCommand: xhsSearchCommand,
30
+ userCommand: xhsUserCommand,
31
+ userNotesCommand: xhsUserNotesCommand,
32
+ darenReportCommand: xhsDarenReportCommand,
33
+ } = require("../src/commands/xhs");
34
+ const {
35
+ articleDataCommand: wxArticleDataCommand,
36
+ historyCommand: wxHistoryCommand,
37
+ } = require("../src/commands/wx");
38
+
39
+ const program = new Command();
40
+
41
+ function collect(value, previous) {
42
+ return previous ? previous.concat([value]) : [value];
43
+ }
44
+
45
+ program
46
+ .name("aiconductor-cli")
47
+ .description("AIConductor CLI 工具箱")
48
+ .version(require("../package.json").version);
49
+
50
+ // web 子命令组(网页 → Markdown)
51
+ const webCmd = program
52
+ .command("web")
53
+ .description("网页内容转换");
54
+
55
+ webCmd
56
+ .command("to-md")
57
+ .description("将任意网页(含微信公众号文章)转成干净的 Markdown")
58
+ .argument("<url>", "网页链接(须以 http:// 或 https:// 开头)")
59
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
60
+ .option("-t, --timeout <seconds>", "请求超时秒数(默认 30)")
61
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
62
+ .action((url, options) => {
63
+ toMdCommand(url, options);
64
+ });
65
+
66
+ // html 子命令组
67
+ const htmlCmd = program
68
+ .command("html")
69
+ .description("HTML 相关操作");
70
+
71
+ htmlCmd
72
+ .command("publish")
73
+ .description("发布 HTML 代码为在线网页")
74
+ .argument("<html>", "HTML 代码字符串或 HTML 文件路径")
75
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
76
+ .option("-t, --title <title>", "文档标题(用作文件名基础)")
77
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
78
+ .action((html, options) => {
79
+ publishCommand(html, options);
80
+ });
81
+
82
+ // webpage 子命令组(统一发布 Markdown/HTML 为在线网页)
83
+ const webpageCmd = program
84
+ .command("webpage")
85
+ .description("网页发布(支持 Markdown 和 HTML)");
86
+
87
+ webpageCmd
88
+ .command("publish")
89
+ .description("将 Markdown 或 HTML 发布为在线网页(自动识别类型)")
90
+ .argument("<input>", "Markdown/HTML 文本字符串或文件路径")
91
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
92
+ .option("-t, --title <title>", "文件名(不含 .html 后缀)")
93
+ .option("--type <type>", "强制指定类型:md 或 html(默认自动识别)")
94
+ .option("--copy-button", "添加代码复制按钮(仅 Markdown 类型生效)")
95
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
96
+ .action((input, options) => {
97
+ webpagePublishCommand(input, options);
98
+ });
99
+
100
+ webpageCmd
101
+ .command("list")
102
+ .description("查询当前用户已发布的网页")
103
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
104
+ .option("--page <page>", "页码,最小为 1", "1")
105
+ .option("--page-size <size>", "每页条数,范围为 1 到 100", "20")
106
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
107
+ .action((options) => {
108
+ webpageListCommand(options);
109
+ });
110
+
111
+ webpageCmd
112
+ .command("delete")
113
+ .description("删除当前用户指定的已发布网页")
114
+ .argument("<webpage_id>", "网页记录 ID,可通过 webpage list 获取")
115
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
116
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
117
+ .action((webpageId, options) => {
118
+ webpageDeleteCommand(webpageId, options);
119
+ });
120
+
121
+ // search 子命令组
122
+ const searchCmd = program
123
+ .command("search")
124
+ .description("网页/图片搜索");
125
+
126
+ searchCmd
127
+ .command("web")
128
+ .description("网页搜索")
129
+ .argument("<query>", "搜索关键词(1~100字符)")
130
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
131
+ .option("-n, --count <n>", "返回条数(最多50)")
132
+ .option("--time-range <range>", "时间范围:OneDay/OneWeek/OneMonth/OneYear 或 YYYY-MM-DD..YYYY-MM-DD")
133
+ .option("--need-content", "仅返回包含正文的结果")
134
+ .option("--need-url", "仅返回带原文链接的结果")
135
+ .option("--sites <domains>", "限定搜索站点,完整域名以 | 分隔,最多20个")
136
+ .option("--block-hosts <domains>", "屏蔽站点,完整域名以 | 分隔,最多5个")
137
+ .option("--auth-info-level <level>", "权威度过滤:0=不限制,1=仅非常权威内容")
138
+ .option("--auth-level <level>", "兼容别名,等同 --auth-info-level")
139
+ .option("--content-format <format>", "正文格式:text 或 markdown", "text")
140
+ .option("--industry <type>", "行业搜索:finance、game 或 gov")
141
+ .option("--query-rewrite", "开启 Query 改写")
142
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
143
+ .action((query, options) => {
144
+ searchCommand(query, "web", options);
145
+ });
146
+
147
+ searchCmd
148
+ .command("image")
149
+ .description("图片搜索")
150
+ .argument("<query>", "搜索关键词(1~100字符)")
151
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
152
+ .option("-n, --count <n>", "返回条数(最多5)")
153
+ .option("--image-width-min <px>", "图片最小宽度")
154
+ .option("--image-width-max <px>", "图片最大宽度")
155
+ .option("--image-height-min <px>", "图片最小高度")
156
+ .option("--image-height-max <px>", "图片最大高度")
157
+ .option("--image-shapes <shapes>", "图片形状,以 | 分隔:横长方形、竖长方形、方形")
158
+ .option("--query-rewrite", "开启 Query 改写")
159
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
160
+ .action((query, options) => {
161
+ searchCommand(query, "image", options);
162
+ });
163
+
164
+ // content 子命令组
165
+ const contentCmd = program
166
+ .command("content")
167
+ .description("内容选题与素材工具");
168
+
169
+ contentCmd
170
+ .command("briefing")
171
+ .description("聚合多平台热点与小红书热榜,生成选题原料")
172
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
173
+ .option("--sources <ids>", "来源 ID,逗号分隔;默认 zhihu,weibo,douyin,aihot")
174
+ .option("--limit <n>", "每个来源返回条数,范围 1 到 30", "30")
175
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
176
+ .action((options) => {
177
+ briefingCommand(options);
178
+ });
179
+
180
+ // 未知命令处理
181
+
182
+ // douyin 子命令组
183
+ const douyinCmd = program
184
+ .command("douyin")
185
+ .description("抖音数据工具箱");
186
+
187
+ douyinCmd
188
+ .command("video-info")
189
+ .description("获取抖音作品详情(0.01元/次)")
190
+ .argument("<share_url>", "抖音视频分享链接")
191
+ .option("-k, --api-key <key>", "AIConductor API Key")
192
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
193
+ .action((shareUrl, options) => { videoInfoCommand(shareUrl, options); });
194
+
195
+ douyinCmd
196
+ .command("video-comments")
197
+ .description("获取抖音作品评论(0.01元/次)")
198
+ .argument("<video_url>", "抖音视频URL")
199
+ .option("-k, --api-key <key>", "AIConductor API Key")
200
+ .option("--max-count <n>", "获取评论数量", "50")
201
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
202
+ .action((videoUrl, options) => { videoCommentsCommand(videoUrl, options); });
203
+
204
+ douyinCmd
205
+ .command("user-videos")
206
+ .description("获取抖音用户视频列表(0.03元/页)")
207
+ .argument("<home_page>", "抖音用户主页URL")
208
+ .option("-k, --api-key <key>", "AIConductor API Key")
209
+ .option("--max-pages <n>", "最大页数", "1")
210
+ .option("--max-seconds <n>", "最长运行时间(秒),最大180", "50")
211
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
212
+ .action((homePage, options) => { userVideosCommand(homePage, options); });
213
+
214
+ douyinCmd
215
+ .command("user-detail")
216
+ .description("获取抖音用户详情(0.03元/次)")
217
+ .argument("<home_page>", "抖音用户主页URL")
218
+ .option("-k, --api-key <key>", "AIConductor API Key")
219
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
220
+ .action((homePage, options) => { userDetailCommand(homePage, options); });
221
+
222
+ douyinCmd
223
+ .command("user-search")
224
+ .description("搜索抖音用户(0.15元/页)")
225
+ .argument("<keyword>", "搜索关键词")
226
+ .option("-k, --api-key <key>", "AIConductor API Key")
227
+ .option("--max-pages <n>", "最大页数,0=不限制", "1")
228
+ .option("--max-seconds <n>", "最长运行时间(秒),最大180", "50")
229
+ .option("--fans-range <range>", "粉丝数量筛选:0_1k/1k_1w/1w_10w/10w_100w/100w_")
230
+ .option("--user-type <type>", "用户类型筛选:common_user/enterprise_user/personal_user")
231
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
232
+ .action((keyword, options) => { userSearchCommand(keyword, options); });
233
+
234
+ douyinCmd
235
+ .command("video-search")
236
+ .description("搜索抖音视频(0.15元/页)")
237
+ .argument("<keyword>", "搜索关键词")
238
+ .option("-k, --api-key <key>", "AIConductor API Key")
239
+ .option("--max-pages <n>", "最大页数,0=不限制", "1")
240
+ .option("--max-seconds <n>", "最长运行时间(秒),最大50", "50")
241
+ .option("--sort-type <type>", "排序方式:0=综合,1=最多点赞,2=最新发布", "0")
242
+ .option("--publish-time <time>", "发布时间:0=不限,1=一天,7=一周,180=半年", "0")
243
+ .option("--filter-duration <dur>", "视频时长:0=不限,0-1=1分钟内,1-5=1-5分钟,5-10000=5分钟以上", "0")
244
+ .option("--content-type <type>", "内容类型:0=不限,1=视频,2=图片,3=文章", "0")
245
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
246
+ .action((keyword, options) => { videoSearchCommand(keyword, options); });
247
+
248
+ douyinCmd
249
+ .command("video-original")
250
+ .description("抖音原画下载:取最高画质播放直链(普通清晰度请用 Get_Download_Url)")
251
+ .argument("<video-url>", "抖音链接、分享文案或作品 ID")
252
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
253
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
254
+ .action((videoUrl, options) => {
255
+ videoOriginalCommand(videoUrl, options);
256
+ });
257
+
258
+ douyinCmd
259
+ .command("topic-radar")
260
+ .description("抖音选题雷达:热词榜 + 当前热点 + 飙升热点(并行调用三个原子接口)")
261
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
262
+ .option("-n, --limit <n>", "飙升榜条数(1~20,默认 10)")
263
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
264
+ .action((options) => {
265
+ topicRadarCommand(options);
266
+ });
267
+
268
+ douyinCmd
269
+ .command("link-to-text")
270
+ .description("抖音作品链接转文字(0.01元/次 + 0.0003元/秒)")
271
+ .argument("<video_url>", "抖音视频URL")
272
+ .option("-k, --api-key <key>", "AIConductor API Key")
273
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
274
+ .action((videoUrl, options) => { linkToTextCommand(videoUrl, options); });
275
+
276
+ // xhs 子命令组
277
+ const xhsCmd = program
278
+ .command("xhs")
279
+ .description("小红书数据工具箱");
280
+
281
+ xhsCmd
282
+ .command("hot-list")
283
+ .description("获取小红书实时热榜")
284
+ .option("-k, --api-key <key>", "AIConductor API Key")
285
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
286
+ .action((options) => { xhsHotListCommand(options); });
287
+
288
+ xhsCmd
289
+ .command("note-publish")
290
+ .description("生成小红书扫码发布页与二维码(0.05元/次)")
291
+ .argument("<type>", "笔记类型:normal(图文)或 video(视频)")
292
+ .option("-k, --api-key <key>", "AIConductor API Key")
293
+ .option("-t, --title <title>", "笔记标题(最多20字符)")
294
+ .option("--content <text>", "笔记正文(最多1000字符)")
295
+ .option("--images <urls>", "图片公网URL列表,逗号分隔(normal类型,最多18张)")
296
+ .option("--image-file <path>", "本地图片路径,可重复使用(normal类型,最多18张)", collect)
297
+ .option("--image-base64 <data>", "图片Base64/data URL/@文本文件,可重复使用", collect)
298
+ .option("--video <url>", "视频公网URL(与--video-file、--video-base64三选一)")
299
+ .option("--video-file <path>", "本地视频路径(与--video、--video-base64三选一)")
300
+ .option("--video-base64 <data>", "视频Base64/data URL/@文本文件(与其他视频来源三选一)")
301
+ .option("--cover <url>", "视频封面图公网URL(与其他封面来源三选一)")
302
+ .option("--cover-file <path>", "本地视频封面路径(仅video类型有效)")
303
+ .option("--cover-base64 <data>", "视频封面Base64/data URL/@文本文件(仅video类型)")
304
+ .option("--upload-valid-days <days>", "本地/Base64素材临时链接有效期:1或7天", "7")
305
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
306
+ .action((type, options) => { notePublishCommand(type, options); });
307
+
308
+ xhsCmd
309
+ .command("note")
310
+ .description("获取小红书笔记详情(按次计费)")
311
+ .argument("<ref>", "笔记链接、xhslink 短链、分享口令或 24 位 note_id")
312
+ .option("-k, --api-key <key>", "AIConductor API Key")
313
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
314
+ .action((ref, options) => { xhsNoteCommand(ref, options); });
315
+
316
+ xhsCmd
317
+ .command("comments")
318
+ .description("获取小红书笔记评论,含可见的楼内回复(按成功翻页计费)")
319
+ .argument("<ref>", "笔记链接、xhslink 短链、分享口令或 24 位 note_id")
320
+ .option("-k, --api-key <key>", "AIConductor API Key")
321
+ .option("--max-pages <n>", "最大翻页数,范围 1~5(每页约 10 条)", "1")
322
+ .option("--max-seconds <n>", "最长运行时间(秒),最大 170", "50")
323
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
324
+ .action((ref, options) => { xhsCommentsCommand(ref, options); });
325
+
326
+ xhsCmd
327
+ .command("search")
328
+ .description("按关键词搜索小红书笔记(按成功翻页计费,每页约 20 条)")
329
+ .argument("<keyword>", "搜索关键词")
330
+ .option("-k, --api-key <key>", "AIConductor API Key")
331
+ .option("--sort <sort>", "排序:general/time_descending/popularity_descending/comment_descending/collect_descending")
332
+ .option("--note-time <range>", "发布时间:day/week/halfyear(不传=不限)")
333
+ .option("--note-type <type>", "笔记类型:video/note(不传=不限)")
334
+ .option("--max-pages <n>", "最大翻页数,范围 1~5", "1")
335
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
336
+ .action((keyword, options) => { xhsSearchCommand(keyword, options); });
337
+
338
+ xhsCmd
339
+ .command("user")
340
+ .description("获取小红书用户详情(按次计费)")
341
+ .argument("<ref>", "主页链接 /user/profile/ 或 24 位 user_id")
342
+ .option("-k, --api-key <key>", "AIConductor API Key")
343
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
344
+ .action((ref, options) => { xhsUserCommand(ref, options); });
345
+
346
+ xhsCmd
347
+ .command("daren-report")
348
+ .description("小红书达人报告:详情 + 粉丝画像 + 笔记性价比(并行调用三个原子接口并打分)")
349
+ .argument("<input>", "达人 user_id(24 位十六进制)或主页链接")
350
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
351
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
352
+ .action((input, options) => {
353
+ xhsDarenReportCommand(input, options);
354
+ });
355
+
356
+ xhsCmd
357
+ .command("user-notes")
358
+ .description("获取小红书用户笔记列表(按成功翻页计费,每页约 20 条)")
359
+ .argument("<ref>", "主页链接 /user/profile/ 或 24 位 user_id")
360
+ .option("-k, --api-key <key>", "AIConductor API Key")
361
+ .option("--max-pages <n>", "最大翻页数,范围 1~5", "1")
362
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
363
+ .action((ref, options) => { xhsUserNotesCommand(ref, options); });
364
+
365
+ // wx 子命令组(公众号数据)
366
+ const wxCmd = program
367
+ .command("wx")
368
+ .description("微信公众号数据工具箱");
369
+
370
+ wxCmd
371
+ .command("article-data")
372
+ .description("获取公众号文章互动数据(按次计费)")
373
+ .argument("<url>", "微信文章链接")
374
+ .option("-k, --api-key <key>", "AIConductor API Key")
375
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
376
+ .action((url, options) => { wxArticleDataCommand(url, options); });
377
+
378
+ wxCmd
379
+ .command("history")
380
+ .description("获取公众号历史文章列表(按成功翻页次数计费)")
381
+ .argument("[url]", "微信文章链接(用于定位公众号)")
382
+ .option("-k, --api-key <key>", "AIConductor API Key")
383
+ .option("--name <name>", "公众号名称或微信 ID(与 url 至少提供一个)")
384
+ .option("--max-pages <n>", "最大翻页数量", "1")
385
+ .option("--max-seconds <n>", "最长运行时间(秒),最大 170", "50")
386
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
387
+ .action((url, options) => { wxHistoryCommand(url, options); });
388
+
389
+ // 未知命令处理
390
+ program.on("command:*", () => {
391
+ console.error(`未知命令: ${program.args.join(" ")}`);
392
+ console.error("使用 --help 查看可用命令。");
393
+ process.exit(1);
394
+ });
395
+
396
+ program.parse(process.argv);
397
+
398
+ // 没有参数时显示帮助
399
+ if (!process.argv.slice(2).length) {
400
+ program.outputHelp();
401
+ }