aiconductor-cli 1.6.0 → 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.
- package/README.md +565 -488
- package/bin/aiconductor-cli.js +401 -351
- package/package.json +1 -1
- package/src/api.js +135 -3
- package/src/api.test.js +292 -4
- package/src/commands/content.js +184 -184
- package/src/commands/douyin.js +174 -0
- package/src/commands/html_publish.js +54 -54
- package/src/commands/md_publish.js +175 -175
- package/src/commands/web.js +69 -0
- package/src/commands/web_search.js +99 -99
- package/src/commands/wx.js +116 -116
- package/src/commands/xhs.js +763 -609
- package/src/lib/cli-utils.js +172 -172
- package/src/lib/daren-score.js +91 -0
- package/src/lib/daren-score.test.js +57 -0
- package/AGENTS.md +0 -193
- package/api_docs/aic_web_search.md +0 -84
- package/api_docs/audio_converter.md +0 -51
- package/api_docs/balance_query.md +0 -38
- package/api_docs/bing_search.md +0 -55
- package/api_docs/china_stock_data.md +0 -221
- package/api_docs/delete_published_webpage.md +0 -38
- package/api_docs/doubao_search.md +0 -80
- package/api_docs/douyin_link_to_text_v1.md +0 -50
- package/api_docs/douyin_link_to_text_v2.md +0 -50
- package/api_docs/douyin_user_detail.md +0 -65
- package/api_docs/douyin_user_search.md +0 -58
- package/api_docs/douyin_user_videos.md +0 -49
- package/api_docs/douyin_user_videos_async.md +0 -45
- package/api_docs/douyin_user_videos_async_query.md +0 -41
- package/api_docs/douyin_user_videos_max.md +0 -59
- package/api_docs/douyin_video_comments.md +0 -68
- package/api_docs/douyin_video_info.md +0 -70
- package/api_docs/douyin_video_search.md +0 -60
- package/api_docs/douyin_video_search_fast.md +0 -48
- package/api_docs/fast_ocr.md +0 -51
- package/api_docs/flow_article2podcast_creat.md +0 -41
- package/api_docs/flow_article2podcast_query.md +0 -41
- package/api_docs/flow_wx_history_articles.md +0 -45
- package/api_docs/generate_image.md +0 -68
- package/api_docs/get_duration.md +0 -37
- package/api_docs/hot_list_mixed.md +0 -122
- package/api_docs/html_publish.md +0 -50
- package/api_docs/html_publish_flexible.md +0 -65
- package/api_docs/image_resize.md +0 -58
- package/api_docs/image_to_permalink.md +0 -61
- package/api_docs/link_expander.md +0 -39
- package/api_docs/llm_proxy.md +0 -61
- package/api_docs/markitdown.md +0 -47
- package/api_docs/md_to_docx.md +0 -51
- package/api_docs/md_to_html.md +0 -53
- package/api_docs/md_to_mindmap.md +0 -52
- package/api_docs/md_to_pdf.md +0 -52
- package/api_docs/md_to_png.md +0 -53
- package/api_docs/md_to_txt.md +0 -51
- package/api_docs/md_to_wxhtml.md +0 -64
- package/api_docs/md_to_xhs.md +0 -87
- package/api_docs/md_to_xlsx.md +0 -52
- package/api_docs/portrait_enhancement.md +0 -69
- package/api_docs/published_webpages.md +0 -45
- package/api_docs/r2_uploader.md +0 -51
- package/api_docs/schedulerx_job_create.md +0 -56
- package/api_docs/transaction_query.md +0 -52
- package/api_docs/url_to_markdown.md +0 -50
- package/api_docs/video_download_url.md +0 -57
- package/api_docs/video_download_url_oss.md +0 -55
- package/api_docs/video_to_text.md +0 -48
- package/api_docs/video_to_text_v2.md +0 -49
- package/api_docs/volcengine_face_pretty.md +0 -55
- package/api_docs/volcengine_faceswap.md +0 -55
- package/api_docs/website_screenshot.md +0 -49
- package/api_docs/wx_access_token.md +0 -44
- package/api_docs/wx_article_analysis_data_push.md +0 -43
- package/api_docs/wx_article_data.md +0 -48
- package/api_docs/wx_article_style_rewrite.md +0 -45
- package/api_docs/wx_draft_add.md +0 -56
- package/api_docs/wx_draft_publish.md +0 -47
- package/api_docs/wx_history_articles.md +0 -89
- package/api_docs/wx_image_upload.md +0 -46
- package/api_docs/wx_md_to_html.md +0 -48
- package/api_docs/wx_rss_reader.md +0 -59
- package/api_docs/xhs_hot_list.md +0 -48
- package/api_docs/xhs_note_comments_fast.md +0 -54
- package/api_docs/xhs_note_info_v2.md +0 -45
- package/api_docs/xhs_note_info_v3.md +0 -69
- package/api_docs/xhs_note_publish.md +0 -54
- package/api_docs/xhs_note_search_v2.md +0 -73
- package/api_docs/xhs_note_search_v3.md +0 -54
- package/api_docs/xhs_user_info_v2.md +0 -61
- package/api_docs/xhs_user_notes_v2.md +0 -56
- package/api_docs/xhs_user_notes_v3.md +0 -48
package/src/commands/wx.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
const { wxArticleData, wxHistoryArticles } = require("../api");
|
|
2
|
-
const { outputResult, resolveKeyOrExit, handleApiError } = require("../lib/cli-utils");
|
|
3
|
-
|
|
4
|
-
// wx_article_data 的真实返回字段(2026-11-04 线上实测);上游改名时未知键仍原样输出
|
|
5
|
-
const ARTICLE_DATA_LABELS = [
|
|
6
|
-
["read", "阅读"],
|
|
7
|
-
["zan", "点赞"],
|
|
8
|
-
["looking", "在看"],
|
|
9
|
-
["share_num", "分享"],
|
|
10
|
-
["collect_num", "收藏"],
|
|
11
|
-
["comment_count", "评论"],
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 获取公众号文章互动数据
|
|
16
|
-
* @param {string} url 微信文章链接
|
|
17
|
-
* @param {object} options
|
|
18
|
-
*/
|
|
19
|
-
async function articleDataCommand(url, options = {}) {
|
|
20
|
-
const format = options.format || "json";
|
|
21
|
-
const apiKey = resolveKeyOrExit(options.apiKey, format);
|
|
22
|
-
try {
|
|
23
|
-
const result = await wxArticleData(apiKey, url);
|
|
24
|
-
outputResult(result, format, formatArticleDataText);
|
|
25
|
-
process.exit(0);
|
|
26
|
-
} catch (err) { handleApiError(err, format); process.exit(1); }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 获取公众号历史文章列表
|
|
31
|
-
* @param {string|undefined} url 微信文章链接(用于定位公众号)
|
|
32
|
-
* @param {object} options
|
|
33
|
-
*/
|
|
34
|
-
async function historyCommand(url, options = {}) {
|
|
35
|
-
const format = options.format || "json";
|
|
36
|
-
const apiKey = resolveKeyOrExit(options.apiKey, format);
|
|
37
|
-
try {
|
|
38
|
-
const result = await wxHistoryArticles(apiKey, {
|
|
39
|
-
url,
|
|
40
|
-
name: options.name,
|
|
41
|
-
maxPages: options.maxPages,
|
|
42
|
-
maxSeconds: options.maxSeconds,
|
|
43
|
-
});
|
|
44
|
-
outputResult(result, format, formatHistoryText);
|
|
45
|
-
process.exit(0);
|
|
46
|
-
} catch (err) { handleApiError(err, format); process.exit(1); }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* text 输出:公众号文章互动数据(已知字段给中文标签,未知字段原样输出)
|
|
51
|
-
* @param {object} resp
|
|
52
|
-
* @returns {string}
|
|
53
|
-
*/
|
|
54
|
-
function formatArticleDataText(resp = {}) {
|
|
55
|
-
const data = resp.data || {};
|
|
56
|
-
const lines = ["✓ 公众号文章互动数据"];
|
|
57
|
-
if (resp.message) lines.push(` 消息: ${resp.message}`);
|
|
58
|
-
|
|
59
|
-
const printed = new Set();
|
|
60
|
-
const known = [];
|
|
61
|
-
ARTICLE_DATA_LABELS.forEach(([key, label]) => {
|
|
62
|
-
if (data[key] === undefined) return;
|
|
63
|
-
printed.add(key);
|
|
64
|
-
known.push(` ${label}: ${data[key]}`);
|
|
65
|
-
});
|
|
66
|
-
const extras = Object.keys(data)
|
|
67
|
-
.filter((key) => !printed.has(key))
|
|
68
|
-
.map((key) => {
|
|
69
|
-
const value = data[key];
|
|
70
|
-
return ` ${key}: ${value !== null && typeof value === "object" ? JSON.stringify(value) : String(value)}`;
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
if (known.length === 0 && extras.length === 0) {
|
|
74
|
-
lines.push(" 上游未返回字段(用 -f json 查看原始响应)");
|
|
75
|
-
return lines.join("\n");
|
|
76
|
-
}
|
|
77
|
-
return lines.concat(known, extras).join("\n");
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* text 输出:公众号历史文章列表
|
|
82
|
-
* @param {object} resp
|
|
83
|
-
* @returns {string}
|
|
84
|
-
*/
|
|
85
|
-
function formatHistoryText(resp = {}) {
|
|
86
|
-
const data = resp.data || {};
|
|
87
|
-
const articles = Array.isArray(data.data) ? data.data : [];
|
|
88
|
-
const lines = ["✓ 公众号历史文章"];
|
|
89
|
-
const nickname = data.mp_nickname || data.nickname;
|
|
90
|
-
// 实测用 name 定位时只有 mp_ghid,api_docs 里的 mp_wxid / head_img 并不返回
|
|
91
|
-
const accountId = data.mp_wxid || data.wxid || data.mp_ghid;
|
|
92
|
-
if (nickname) lines.push(` 公众号: ${nickname}${accountId ? `(${accountId})` : ""}`);
|
|
93
|
-
lines.push(` 篇数: ${articles.length}`);
|
|
94
|
-
if (data.now_page !== undefined) lines.push(` 翻页: ${data.now_page}`);
|
|
95
|
-
|
|
96
|
-
articles.forEach((item, index) => {
|
|
97
|
-
lines.push(`\n[${index + 1}] ${item.title || "未命名文章"}`);
|
|
98
|
-
if (item.post_time_str) lines.push(` 时间: ${item.post_time_str}`);
|
|
99
|
-
const stats = [];
|
|
100
|
-
if (item.read !== undefined) stats.push(`阅读 ${item.read}`);
|
|
101
|
-
if (item.zan !== undefined) stats.push(`点赞 ${item.zan}`);
|
|
102
|
-
if (item.original) stats.push("原创");
|
|
103
|
-
if (stats.length > 0) lines.push(` 数据: ${stats.join(" | ")}`);
|
|
104
|
-
if (item.digest) lines.push(` 摘要: ${item.digest}`);
|
|
105
|
-
if (item.url) lines.push(` URL: ${item.url}`);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
return lines.join("\n");
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
module.exports = {
|
|
112
|
-
articleDataCommand,
|
|
113
|
-
historyCommand,
|
|
114
|
-
formatArticleDataText,
|
|
115
|
-
formatHistoryText,
|
|
116
|
-
};
|
|
1
|
+
const { wxArticleData, wxHistoryArticles } = require("../api");
|
|
2
|
+
const { outputResult, resolveKeyOrExit, handleApiError } = require("../lib/cli-utils");
|
|
3
|
+
|
|
4
|
+
// wx_article_data 的真实返回字段(2026-11-04 线上实测);上游改名时未知键仍原样输出
|
|
5
|
+
const ARTICLE_DATA_LABELS = [
|
|
6
|
+
["read", "阅读"],
|
|
7
|
+
["zan", "点赞"],
|
|
8
|
+
["looking", "在看"],
|
|
9
|
+
["share_num", "分享"],
|
|
10
|
+
["collect_num", "收藏"],
|
|
11
|
+
["comment_count", "评论"],
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取公众号文章互动数据
|
|
16
|
+
* @param {string} url 微信文章链接
|
|
17
|
+
* @param {object} options
|
|
18
|
+
*/
|
|
19
|
+
async function articleDataCommand(url, options = {}) {
|
|
20
|
+
const format = options.format || "json";
|
|
21
|
+
const apiKey = resolveKeyOrExit(options.apiKey, format);
|
|
22
|
+
try {
|
|
23
|
+
const result = await wxArticleData(apiKey, url);
|
|
24
|
+
outputResult(result, format, formatArticleDataText);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
} catch (err) { handleApiError(err, format); process.exit(1); }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 获取公众号历史文章列表
|
|
31
|
+
* @param {string|undefined} url 微信文章链接(用于定位公众号)
|
|
32
|
+
* @param {object} options
|
|
33
|
+
*/
|
|
34
|
+
async function historyCommand(url, options = {}) {
|
|
35
|
+
const format = options.format || "json";
|
|
36
|
+
const apiKey = resolveKeyOrExit(options.apiKey, format);
|
|
37
|
+
try {
|
|
38
|
+
const result = await wxHistoryArticles(apiKey, {
|
|
39
|
+
url,
|
|
40
|
+
name: options.name,
|
|
41
|
+
maxPages: options.maxPages,
|
|
42
|
+
maxSeconds: options.maxSeconds,
|
|
43
|
+
});
|
|
44
|
+
outputResult(result, format, formatHistoryText);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
} catch (err) { handleApiError(err, format); process.exit(1); }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* text 输出:公众号文章互动数据(已知字段给中文标签,未知字段原样输出)
|
|
51
|
+
* @param {object} resp
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
function formatArticleDataText(resp = {}) {
|
|
55
|
+
const data = resp.data || {};
|
|
56
|
+
const lines = ["✓ 公众号文章互动数据"];
|
|
57
|
+
if (resp.message) lines.push(` 消息: ${resp.message}`);
|
|
58
|
+
|
|
59
|
+
const printed = new Set();
|
|
60
|
+
const known = [];
|
|
61
|
+
ARTICLE_DATA_LABELS.forEach(([key, label]) => {
|
|
62
|
+
if (data[key] === undefined) return;
|
|
63
|
+
printed.add(key);
|
|
64
|
+
known.push(` ${label}: ${data[key]}`);
|
|
65
|
+
});
|
|
66
|
+
const extras = Object.keys(data)
|
|
67
|
+
.filter((key) => !printed.has(key))
|
|
68
|
+
.map((key) => {
|
|
69
|
+
const value = data[key];
|
|
70
|
+
return ` ${key}: ${value !== null && typeof value === "object" ? JSON.stringify(value) : String(value)}`;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (known.length === 0 && extras.length === 0) {
|
|
74
|
+
lines.push(" 上游未返回字段(用 -f json 查看原始响应)");
|
|
75
|
+
return lines.join("\n");
|
|
76
|
+
}
|
|
77
|
+
return lines.concat(known, extras).join("\n");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* text 输出:公众号历史文章列表
|
|
82
|
+
* @param {object} resp
|
|
83
|
+
* @returns {string}
|
|
84
|
+
*/
|
|
85
|
+
function formatHistoryText(resp = {}) {
|
|
86
|
+
const data = resp.data || {};
|
|
87
|
+
const articles = Array.isArray(data.data) ? data.data : [];
|
|
88
|
+
const lines = ["✓ 公众号历史文章"];
|
|
89
|
+
const nickname = data.mp_nickname || data.nickname;
|
|
90
|
+
// 实测用 name 定位时只有 mp_ghid,backend/api_docs 里的 mp_wxid / head_img 并不返回
|
|
91
|
+
const accountId = data.mp_wxid || data.wxid || data.mp_ghid;
|
|
92
|
+
if (nickname) lines.push(` 公众号: ${nickname}${accountId ? `(${accountId})` : ""}`);
|
|
93
|
+
lines.push(` 篇数: ${articles.length}`);
|
|
94
|
+
if (data.now_page !== undefined) lines.push(` 翻页: ${data.now_page}`);
|
|
95
|
+
|
|
96
|
+
articles.forEach((item, index) => {
|
|
97
|
+
lines.push(`\n[${index + 1}] ${item.title || "未命名文章"}`);
|
|
98
|
+
if (item.post_time_str) lines.push(` 时间: ${item.post_time_str}`);
|
|
99
|
+
const stats = [];
|
|
100
|
+
if (item.read !== undefined) stats.push(`阅读 ${item.read}`);
|
|
101
|
+
if (item.zan !== undefined) stats.push(`点赞 ${item.zan}`);
|
|
102
|
+
if (item.original) stats.push("原创");
|
|
103
|
+
if (stats.length > 0) lines.push(` 数据: ${stats.join(" | ")}`);
|
|
104
|
+
if (item.digest) lines.push(` 摘要: ${item.digest}`);
|
|
105
|
+
if (item.url) lines.push(` URL: ${item.url}`);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return lines.join("\n");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = {
|
|
112
|
+
articleDataCommand,
|
|
113
|
+
historyCommand,
|
|
114
|
+
formatArticleDataText,
|
|
115
|
+
formatHistoryText,
|
|
116
|
+
};
|