@ikenxuan/amagi 6.4.0 → 6.5.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/dist/default/index.cjs +230 -1056
- package/dist/default/index.d.ts +499 -1001
- package/dist/default/index.mjs +230 -1042
- package/dist/exports/axios.cjs +1 -1
- package/dist/exports/express.cjs +1 -1
- package/dist/{rolldown-runtime-D6vf50IK.cjs → rolldown-runtime-VH7oDXx4.cjs} +1 -1
- package/package.json +4 -4
package/dist/default/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
5
|
+
const require_rolldown_runtime = require("../rolldown-runtime-VH7oDXx4.cjs");
|
|
6
6
|
let node_url = require("node:url");
|
|
7
7
|
node_url = require_rolldown_runtime.__toESM(node_url, 1);
|
|
8
8
|
let node_events = require("node:events");
|
|
@@ -13,450 +13,11 @@ let node_crypto = require("node:crypto");
|
|
|
13
13
|
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
14
14
|
let axios = require("axios");
|
|
15
15
|
axios = require_rolldown_runtime.__toESM(axios, 1);
|
|
16
|
-
let chalk = require("chalk");
|
|
17
16
|
let protobufjs = require("protobufjs");
|
|
18
17
|
protobufjs = require_rolldown_runtime.__toESM(protobufjs, 1);
|
|
19
18
|
let express = require("express");
|
|
20
19
|
express = require_rolldown_runtime.__toESM(express, 1);
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 废弃 API 注册表
|
|
24
|
-
* 存储所有已注册的废弃 API 配置
|
|
25
|
-
*/
|
|
26
|
-
const deprecatedApis = /* @__PURE__ */ new Map();
|
|
27
|
-
/**
|
|
28
|
-
* 注册一个废弃的 API
|
|
29
|
-
*
|
|
30
|
-
* 将 API 添加到废弃注册表中,后续可通过 checkDeprecation 检查
|
|
31
|
-
*
|
|
32
|
-
* @param config - 废弃配置对象
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* registerDeprecatedApi({
|
|
37
|
-
* name: 'getDouyinData',
|
|
38
|
-
* deprecatedIn: '6.0.0',
|
|
39
|
-
* removedIn: '7.0.0',
|
|
40
|
-
* replacement: 'douyinFetcher',
|
|
41
|
-
* throwError: true
|
|
42
|
-
* })
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
function registerDeprecatedApi(config) {
|
|
46
|
-
deprecatedApis.set(config.name, config);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 检查 API 是否已废弃并进行相应处理
|
|
50
|
-
*
|
|
51
|
-
* 如果 API 已注册为废弃,根据配置决定是打印警告还是抛出错误
|
|
52
|
-
*
|
|
53
|
-
* @param apiName - 要检查的 API 名称
|
|
54
|
-
* @throws {DeprecatedApiError} 如果 API 已废弃且配置为抛出错误
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // 在函数开头调用检查
|
|
59
|
-
* function getDouyinData(options) {
|
|
60
|
-
* checkDeprecation('getDouyinData')
|
|
61
|
-
* // ...
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
function checkDeprecation(apiName) {
|
|
66
|
-
const config = deprecatedApis.get(apiName);
|
|
67
|
-
if (!config) return;
|
|
68
|
-
const message = buildDeprecationMessage(config);
|
|
69
|
-
if (config.throwError) throw new DeprecatedApiError(message, config);
|
|
70
|
-
else console.warn(message);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* 根据配置构建废弃提示消息
|
|
74
|
-
*
|
|
75
|
-
* @param config - 废弃配置
|
|
76
|
-
* @returns 格式化的废弃提示消息字符串
|
|
77
|
-
*/
|
|
78
|
-
function buildDeprecationMessage(config) {
|
|
79
|
-
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn} 版本废弃。`];
|
|
80
|
-
if (config.replacement) lines.push(`请使用 "${config.replacement}" 替代。`);
|
|
81
|
-
else lines.push("此接口已被上游删除,无法继续使用,无可用替代方案。");
|
|
82
|
-
if (config.removedIn) lines.push(`此 API 将在 v${config.removedIn} 版本移除。`);
|
|
83
|
-
if (config.migrationGuide) lines.push(`迁移指南: ${config.migrationGuide}`);
|
|
84
|
-
return lines.join("\n");
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* 废弃 API 调用错误类
|
|
88
|
-
*
|
|
89
|
-
* 当调用已废弃且配置为抛出错误的 API 时抛出此错误
|
|
90
|
-
* 包含完整的废弃配置信息,便于调试和迁移
|
|
91
|
-
*/
|
|
92
|
-
var DeprecatedApiError = class DeprecatedApiError extends Error {
|
|
93
|
-
/** 废弃配置信息,包含替代方案等详细信息 */
|
|
94
|
-
config;
|
|
95
|
-
/**
|
|
96
|
-
* 创建废弃 API 错误实例
|
|
97
|
-
*
|
|
98
|
-
* @param message - 错误消息
|
|
99
|
-
* @param config - 废弃配置对象
|
|
100
|
-
*/
|
|
101
|
-
constructor(message, config) {
|
|
102
|
-
super(message);
|
|
103
|
-
this.name = "DeprecatedApiError";
|
|
104
|
-
this.config = config;
|
|
105
|
-
Error.captureStackTrace?.(this, DeprecatedApiError);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
registerDeprecatedApi({
|
|
109
|
-
name: "getDouyinData",
|
|
110
|
-
deprecatedIn: "6.0.0",
|
|
111
|
-
removedIn: "7.0.0",
|
|
112
|
-
replacement: "douyinFetcher 或 client.douyin.fetcher",
|
|
113
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
114
|
-
throwError: true
|
|
115
|
-
});
|
|
116
|
-
registerDeprecatedApi({
|
|
117
|
-
name: "getBilibiliData",
|
|
118
|
-
deprecatedIn: "6.0.0",
|
|
119
|
-
removedIn: "7.0.0",
|
|
120
|
-
replacement: "bilibiliFetcher 或 client.bilibili.fetcher",
|
|
121
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
122
|
-
throwError: true
|
|
123
|
-
});
|
|
124
|
-
registerDeprecatedApi({
|
|
125
|
-
name: "getKuaishouData",
|
|
126
|
-
deprecatedIn: "6.0.0",
|
|
127
|
-
removedIn: "7.0.0",
|
|
128
|
-
replacement: "kuaishouFetcher 或 client.kuaishou.fetcher",
|
|
129
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
130
|
-
throwError: true
|
|
131
|
-
});
|
|
132
|
-
registerDeprecatedApi({
|
|
133
|
-
name: "getXiaohongshuData",
|
|
134
|
-
deprecatedIn: "6.0.0",
|
|
135
|
-
removedIn: "7.0.0",
|
|
136
|
-
replacement: "xiaohongshuFetcher 或 client.xiaohongshu.fetcher",
|
|
137
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
138
|
-
throwError: true
|
|
139
|
-
});
|
|
140
|
-
[
|
|
141
|
-
{
|
|
142
|
-
name: "单个视频作品数据",
|
|
143
|
-
replacement: "fetchVideoInfo"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "单个视频下载信息数据",
|
|
147
|
-
replacement: "fetchVideoStreamUrl"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "评论数据",
|
|
151
|
-
replacement: "fetchComments"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "指定评论的回复",
|
|
155
|
-
replacement: "fetchCommentReplies"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "用户主页数据",
|
|
159
|
-
replacement: "fetchUserCard"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: "用户主页动态列表数据",
|
|
163
|
-
replacement: "fetchUserDynamicList"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: "用户空间详细信息",
|
|
167
|
-
replacement: "fetchUserSpaceInfo"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: "获取UP主总播放量",
|
|
171
|
-
replacement: "fetchUploaderTotalViews"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: "Emoji数据",
|
|
175
|
-
replacement: "fetchEmojiList"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: "番剧基本信息数据",
|
|
179
|
-
replacement: "fetchBangumiInfo"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: "番剧下载信息数据",
|
|
183
|
-
replacement: "fetchBangumiStreamUrl"
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "动态详情数据",
|
|
187
|
-
replacement: "fetchDynamicDetail"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: "直播间信息",
|
|
191
|
-
replacement: "fetchLiveRoomInfo"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
name: "直播间初始化信息",
|
|
195
|
-
replacement: "fetchLiveRoomInitInfo"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: "登录基本信息",
|
|
199
|
-
replacement: "fetchLoginStatus"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "申请二维码",
|
|
203
|
-
replacement: "requestLoginQrcode"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: "二维码状态",
|
|
207
|
-
replacement: "checkQrcodeStatus"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: "AV转BV",
|
|
211
|
-
replacement: "convertAvToBv"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
name: "BV转AV",
|
|
215
|
-
replacement: "convertBvToAv"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "专栏正文内容",
|
|
219
|
-
replacement: "fetchArticleContent"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: "专栏显示卡片信息",
|
|
223
|
-
replacement: "fetchArticleCards"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
name: "专栏文章基本信息",
|
|
227
|
-
replacement: "fetchArticleInfo"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: "文集基本信息",
|
|
231
|
-
replacement: "fetchArticleListInfo"
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: "实时弹幕",
|
|
235
|
-
replacement: "fetchVideoDanmaku"
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: "从_v_voucher_申请_captcha",
|
|
239
|
-
replacement: "requestCaptchaFromVoucher"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: "验证验证码结果",
|
|
243
|
-
replacement: "validateCaptchaResult"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: "视频作品数据",
|
|
247
|
-
replacement: "fetchVideoWork"
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
name: "图集作品数据",
|
|
251
|
-
replacement: "fetchImageAlbumWork"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: "合辑作品数据",
|
|
255
|
-
replacement: "fetchSlidesWork"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: "文字作品数据",
|
|
259
|
-
replacement: "fetchTextWork"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
name: "聚合解析",
|
|
263
|
-
replacement: "parseWork"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
name: "指定评论回复数据",
|
|
267
|
-
replacement: "fetchCommentReplies"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
name: "用户主页视频列表数据",
|
|
271
|
-
replacement: "fetchUserVideoList"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
name: "热点词数据",
|
|
275
|
-
replacement: "fetchSuggestWords"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: "搜索数据",
|
|
279
|
-
replacement: "searchContent"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
name: "音乐数据",
|
|
283
|
-
replacement: "fetchMusicInfo"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: "直播间信息数据",
|
|
287
|
-
replacement: "fetchLiveRoomInfo"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
name: "申请二维码数据",
|
|
291
|
-
replacement: "requestLoginQrcode"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "动态表情数据",
|
|
295
|
-
replacement: "fetchDynamicEmojiList"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
name: "弹幕数据",
|
|
299
|
-
replacement: "fetchDanmakuList"
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: "单个视频作品数据",
|
|
303
|
-
replacement: "fetchVideoWork"
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: "首页推荐数据",
|
|
307
|
-
replacement: "fetchHomeFeed"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: "单个笔记数据",
|
|
311
|
-
replacement: "fetchNoteDetail"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
name: "用户数据",
|
|
315
|
-
replacement: "fetchUserProfile"
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
name: "用户笔记数据",
|
|
319
|
-
replacement: "fetchUserNoteList"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
name: "表情列表",
|
|
323
|
-
replacement: "fetchEmojiList"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
name: "搜索笔记",
|
|
327
|
-
replacement: "searchNotes"
|
|
328
|
-
}
|
|
329
|
-
].forEach(({ name, replacement }) => {
|
|
330
|
-
registerDeprecatedApi({
|
|
331
|
-
name: `methodType: '${name}'`,
|
|
332
|
-
deprecatedIn: "6.0.0",
|
|
333
|
-
removedIn: "7.0.0",
|
|
334
|
-
replacement: `fetcher.${replacement}()`,
|
|
335
|
-
throwError: true
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
registerDeprecatedApi({
|
|
339
|
-
name: `methodType: '动态卡片数据'`,
|
|
340
|
-
deprecatedIn: "6.0.0",
|
|
341
|
-
removedIn: "7.0.0",
|
|
342
|
-
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
343
|
-
throwError: false
|
|
344
|
-
});
|
|
345
|
-
registerDeprecatedApi({
|
|
346
|
-
name: "fetchDynamicCard",
|
|
347
|
-
deprecatedIn: "6.1.3",
|
|
348
|
-
removedIn: "7.0.0",
|
|
349
|
-
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
350
|
-
throwError: false
|
|
351
|
-
});
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region src/model/DataFetchers.ts
|
|
354
|
-
/**
|
|
355
|
-
* 数据获取器模块 (已废弃)
|
|
356
|
-
*
|
|
357
|
-
* 此模块中的 getXXXData 函数已在 v6 版本废弃并移除
|
|
358
|
-
* 请使用新的 fetcher API 替代
|
|
359
|
-
*
|
|
360
|
-
* @module model/DataFetchers
|
|
361
|
-
* @deprecated v6 已废弃,请使用 fetcher API 替代
|
|
362
|
-
*/
|
|
363
|
-
/**
|
|
364
|
-
* 获取抖音数据
|
|
365
|
-
*
|
|
366
|
-
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
367
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
368
|
-
*
|
|
369
|
-
* @example
|
|
370
|
-
* ```typescript
|
|
371
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
372
|
-
* const data = await getDouyinData('videoWork', { aweme_id: '123' }, cookie)
|
|
373
|
-
*
|
|
374
|
-
* // 新用法
|
|
375
|
-
* import { douyinFetcher } from '@ikenxuan/amagi'
|
|
376
|
-
* const data = await douyinFetcher.fetchVideoWork({ aweme_id: '123' }, cookie)
|
|
377
|
-
*
|
|
378
|
-
* // 或使用客户端实例
|
|
379
|
-
* const client = createAmagiClient({ cookies: { douyin: cookie } })
|
|
380
|
-
* const data = await client.douyin.fetcher.fetchVideoWork({ aweme_id: '123' })
|
|
381
|
-
* ```
|
|
382
|
-
*/
|
|
383
|
-
function getDouyinData(..._args) {
|
|
384
|
-
checkDeprecation("getDouyinData");
|
|
385
|
-
throw new Error("getDouyinData 已废弃");
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* 获取B站数据
|
|
389
|
-
*
|
|
390
|
-
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
391
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
392
|
-
*
|
|
393
|
-
* @example
|
|
394
|
-
* ```typescript
|
|
395
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
396
|
-
* const data = await getBilibiliData('videoInfo', { bvid: 'BV123' }, cookie)
|
|
397
|
-
*
|
|
398
|
-
* // 新用法
|
|
399
|
-
* import { bilibiliFetcher } from '@ikenxuan/amagi'
|
|
400
|
-
* const data = await bilibiliFetcher.fetchVideoInfo({ bvid: 'BV123' }, cookie)
|
|
401
|
-
*
|
|
402
|
-
* // 或使用客户端实例
|
|
403
|
-
* const client = createAmagiClient({ cookies: { bilibili: cookie } })
|
|
404
|
-
* const data = await client.bilibili.fetcher.fetchVideoInfo({ bvid: 'BV123' })
|
|
405
|
-
* ```
|
|
406
|
-
*/
|
|
407
|
-
function getBilibiliData(..._args) {
|
|
408
|
-
checkDeprecation("getBilibiliData");
|
|
409
|
-
throw new Error("getBilibiliData 已废弃");
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* 获取快手数据
|
|
413
|
-
*
|
|
414
|
-
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
415
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
416
|
-
*
|
|
417
|
-
* @example
|
|
418
|
-
* ```typescript
|
|
419
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
420
|
-
* const data = await getKuaishouData('videoWork', { photoId: '123' }, cookie)
|
|
421
|
-
*
|
|
422
|
-
* // 新用法
|
|
423
|
-
* import { kuaishouFetcher } from '@ikenxuan/amagi'
|
|
424
|
-
* const data = await kuaishouFetcher.fetchVideoWork({ photoId: '123' }, cookie)
|
|
425
|
-
*
|
|
426
|
-
* // 或使用客户端实例
|
|
427
|
-
* const client = createAmagiClient({ cookies: { kuaishou: cookie } })
|
|
428
|
-
* const data = await client.kuaishou.fetcher.fetchVideoWork({ photoId: '123' })
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
function getKuaishouData(..._args) {
|
|
432
|
-
checkDeprecation("getKuaishouData");
|
|
433
|
-
throw new Error("getKuaishouData 已废弃");
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* 获取小红书数据
|
|
437
|
-
*
|
|
438
|
-
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
439
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* ```typescript
|
|
443
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
444
|
-
* const data = await getXiaohongshuData('noteDetail', { note_id: '123' }, cookie)
|
|
445
|
-
*
|
|
446
|
-
* // 新用法
|
|
447
|
-
* import { xiaohongshuFetcher } from '@ikenxuan/amagi'
|
|
448
|
-
* const data = await xiaohongshuFetcher.fetchNoteDetail({ note_id: '123' }, cookie)
|
|
449
|
-
*
|
|
450
|
-
* // 或使用客户端实例
|
|
451
|
-
* const client = createAmagiClient({ cookies: { xiaohongshu: cookie } })
|
|
452
|
-
* const data = await client.xiaohongshu.fetcher.fetchNoteDetail({ note_id: '123' })
|
|
453
|
-
* ```
|
|
454
|
-
*/
|
|
455
|
-
function getXiaohongshuData(..._args) {
|
|
456
|
-
checkDeprecation("getXiaohongshuData");
|
|
457
|
-
throw new Error("getXiaohongshuData 已废弃");
|
|
458
|
-
}
|
|
459
|
-
//#endregion
|
|
20
|
+
let chalk = require("chalk");
|
|
460
21
|
//#region src/platform/bilibili/API.ts
|
|
461
22
|
/**
|
|
462
23
|
* B站 API URL 构建类
|
|
@@ -528,15 +89,6 @@ var BilibiliAPI = class {
|
|
|
528
89
|
getDynamicDetail(data) {
|
|
529
90
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data.dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote,endFooterHidden,decorationCard,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,editable,opusPrivateVisible,avatarAutoTheme`;
|
|
530
91
|
}
|
|
531
|
-
/**
|
|
532
|
-
* 获取动态卡片信息
|
|
533
|
-
*
|
|
534
|
-
* @deprecated B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口,该接口已停用。
|
|
535
|
-
* 调用将返回错误信息,请使用 {@link getDynamicDetail} 替代。
|
|
536
|
-
*/
|
|
537
|
-
getDynamicCard(data) {
|
|
538
|
-
return this.getDynamicDetail(data);
|
|
539
|
-
}
|
|
540
92
|
/** 获取用户名片信息 */
|
|
541
93
|
getUserCard(data) {
|
|
542
94
|
return `https://api.bilibili.com/x/web-interface/card?mid=${data.host_mid}&photo=true`;
|
|
@@ -628,86 +180,6 @@ var BilibiliAPI = class {
|
|
|
628
180
|
/** B站 API URL 构建器实例 */
|
|
629
181
|
const bilibiliApiUrls = new BilibiliAPI();
|
|
630
182
|
//#endregion
|
|
631
|
-
//#region src/platform/bilibili/BilibiliApi.ts
|
|
632
|
-
/**
|
|
633
|
-
* 创建废弃的 API 存根函数
|
|
634
|
-
*/
|
|
635
|
-
const createDeprecatedStub$3 = (methodName) => {
|
|
636
|
-
return (..._args) => {
|
|
637
|
-
checkDeprecation("getBilibiliData");
|
|
638
|
-
throw new Error(`bilibili.${methodName} 已废弃,请使用 bilibiliFetcher 替代`);
|
|
639
|
-
};
|
|
640
|
-
};
|
|
641
|
-
/**
|
|
642
|
-
* B站相关 API 的命名空间。
|
|
643
|
-
*
|
|
644
|
-
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
645
|
-
*/
|
|
646
|
-
const bilibili = {
|
|
647
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoInfo 替代 */
|
|
648
|
-
getVideoInfo: createDeprecatedStub$3("getVideoInfo"),
|
|
649
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoStreamUrl 替代 */
|
|
650
|
-
getVideoStream: createDeprecatedStub$3("getVideoStream"),
|
|
651
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchComments 替代 */
|
|
652
|
-
getComments: createDeprecatedStub$3("getComments"),
|
|
653
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchCommentReplies 替代 */
|
|
654
|
-
getCommentReply: createDeprecatedStub$3("getCommentReply"),
|
|
655
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserCard 替代 */
|
|
656
|
-
getUserProfile: createDeprecatedStub$3("getUserProfile"),
|
|
657
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserDynamicList 替代 */
|
|
658
|
-
getUserDynamic: createDeprecatedStub$3("getUserDynamic"),
|
|
659
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchEmojiList 替代 */
|
|
660
|
-
getEmojiList: createDeprecatedStub$3("getEmojiList"),
|
|
661
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiInfo 替代 */
|
|
662
|
-
getBangumiInfo: createDeprecatedStub$3("getBangumiInfo"),
|
|
663
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiStreamUrl 替代 */
|
|
664
|
-
getBangumiStream: createDeprecatedStub$3("getBangumiStream"),
|
|
665
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicDetail 替代 */
|
|
666
|
-
getDynamicInfo: createDeprecatedStub$3("getDynamicInfo"),
|
|
667
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicCard 替代 */
|
|
668
|
-
getDynamicCard: createDeprecatedStub$3("getDynamicCard"),
|
|
669
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInfo 替代 */
|
|
670
|
-
getLiveRoomDetail: createDeprecatedStub$3("getLiveRoomDetail"),
|
|
671
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInitInfo 替代 */
|
|
672
|
-
getLiveRoomInitInfo: createDeprecatedStub$3("getLiveRoomInitInfo"),
|
|
673
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLoginStatus 替代 */
|
|
674
|
-
getLoginBasicInfo: createDeprecatedStub$3("getLoginBasicInfo"),
|
|
675
|
-
/** @deprecated 请使用 bilibiliFetcher.requestLoginQrcode 替代 */
|
|
676
|
-
getLoginQrcode: createDeprecatedStub$3("getLoginQrcode"),
|
|
677
|
-
/** @deprecated 请使用 bilibiliFetcher.checkQrcodeStatus 替代 */
|
|
678
|
-
checkQrcodeStatus: createDeprecatedStub$3("checkQrcodeStatus"),
|
|
679
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUploaderTotalViews 替代 */
|
|
680
|
-
getUserTotalPlayCount: createDeprecatedStub$3("getUserTotalPlayCount"),
|
|
681
|
-
/** @deprecated 请使用 bilibiliFetcher.convertAvToBv 替代 */
|
|
682
|
-
convertAvToBv: createDeprecatedStub$3("convertAvToBv"),
|
|
683
|
-
/** @deprecated 请使用 bilibiliFetcher.convertBvToAv 替代 */
|
|
684
|
-
convertBvToAv: createDeprecatedStub$3("convertBvToAv"),
|
|
685
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleContent 替代 */
|
|
686
|
-
getArticleContent: createDeprecatedStub$3("getArticleContent"),
|
|
687
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleCards 替代 */
|
|
688
|
-
getArticleCard: createDeprecatedStub$3("getArticleCard"),
|
|
689
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleInfo 替代 */
|
|
690
|
-
getArticleInfo: createDeprecatedStub$3("getArticleInfo"),
|
|
691
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleListInfo 替代 */
|
|
692
|
-
getColumnInfo: createDeprecatedStub$3("getColumnInfo"),
|
|
693
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserSpaceInfo 替代 */
|
|
694
|
-
getUserProfileDetail: createDeprecatedStub$3("getUserProfileDetail"),
|
|
695
|
-
/** @deprecated 请使用 bilibiliFetcher.requestCaptchaFromVoucher 替代 */
|
|
696
|
-
applyVoucherCaptcha: createDeprecatedStub$3("applyVoucherCaptcha"),
|
|
697
|
-
/** @deprecated 请使用 bilibiliFetcher.validateCaptchaResult 替代 */
|
|
698
|
-
validateCaptcha: createDeprecatedStub$3("validateCaptcha"),
|
|
699
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoDanmaku 替代 */
|
|
700
|
-
getDanmaku: createDeprecatedStub$3("getDanmaku")
|
|
701
|
-
};
|
|
702
|
-
/**
|
|
703
|
-
* 创建绑定了cookie的B站API对象
|
|
704
|
-
*
|
|
705
|
-
* @deprecated v6 已废弃,请使用 createBoundBilibiliFetcher 替代
|
|
706
|
-
*/
|
|
707
|
-
const createBoundBilibiliApi = (_cookie, _requestConfig) => {
|
|
708
|
-
return { ...bilibili };
|
|
709
|
-
};
|
|
710
|
-
//#endregion
|
|
711
183
|
//#region src/model/events.ts
|
|
712
184
|
/**
|
|
713
185
|
* Amagi 事件系统
|
|
@@ -1020,7 +492,7 @@ const BilibiliBangumiStreamParamsSchema = zod.default.object({
|
|
|
1020
492
|
});
|
|
1021
493
|
/** 动态参数验证 */
|
|
1022
494
|
const BilibiliDynamicParamsSchema = zod.default.object({
|
|
1023
|
-
methodType: zod.default.
|
|
495
|
+
methodType: zod.default.literal("dynamicDetail", { error: "方法类型必须是\"dynamicDetail\"" }),
|
|
1024
496
|
dynamic_id: zod.default.string({ error: "动态ID必须是字符串" }).min(1, { error: "动态ID不能为空" })
|
|
1025
497
|
});
|
|
1026
498
|
/** 直播间参数验证 */
|
|
@@ -1102,7 +574,6 @@ const BilibiliValidationSchemas = {
|
|
|
1102
574
|
bangumiInfo: BilibiliBangumiInfoParamsSchema,
|
|
1103
575
|
bangumiStream: BilibiliBangumiStreamParamsSchema,
|
|
1104
576
|
dynamicDetail: BilibiliDynamicParamsSchema,
|
|
1105
|
-
dynamicCard: BilibiliDynamicParamsSchema,
|
|
1106
577
|
liveRoomInfo: BilibiliLiveParamsSchema,
|
|
1107
578
|
liveRoomInit: BilibiliLiveParamsSchema,
|
|
1108
579
|
loginStatus: BilibiliLoginParamsSchema,
|
|
@@ -1133,7 +604,6 @@ const BilibiliMethodRoutes = {
|
|
|
1133
604
|
bangumiInfo: "/fetch_bangumi_video_info",
|
|
1134
605
|
bangumiStream: "/fetch_bangumi_video_playurl",
|
|
1135
606
|
dynamicDetail: "/fetch_dynamic_info",
|
|
1136
|
-
dynamicCard: "/fetch_dynamic_card",
|
|
1137
607
|
liveRoomInfo: "/fetch_live_room_detail",
|
|
1138
608
|
liveRoomInit: "/fetch_liveroom_def",
|
|
1139
609
|
loginStatus: "/login_basic_info",
|
|
@@ -1710,18 +1180,20 @@ const xiaohongshuApiUrls = {
|
|
|
1710
1180
|
* @returns 完整的接口URL
|
|
1711
1181
|
*/
|
|
1712
1182
|
noteComments(data) {
|
|
1183
|
+
const baseUrl = "https://edith.xiaohongshu.com/api/sns/web/v2/comment/page";
|
|
1184
|
+
const params = {
|
|
1185
|
+
note_id: data.note_id,
|
|
1186
|
+
cursor: data.cursor ?? "",
|
|
1187
|
+
image_formats: [
|
|
1188
|
+
"jpg",
|
|
1189
|
+
"webp",
|
|
1190
|
+
"avif"
|
|
1191
|
+
].join(","),
|
|
1192
|
+
xsec_token: data.xsec_token
|
|
1193
|
+
};
|
|
1713
1194
|
return {
|
|
1714
1195
|
apiPath: "/api/sns/web/v2/comment/page",
|
|
1715
|
-
Url:
|
|
1716
|
-
note_id: data.note_id,
|
|
1717
|
-
cursor: data.cursor ?? "",
|
|
1718
|
-
image_formats: [
|
|
1719
|
-
"jpg",
|
|
1720
|
-
"webp",
|
|
1721
|
-
"avif"
|
|
1722
|
-
].join(","),
|
|
1723
|
-
xsec_token: data.xsec_token
|
|
1724
|
-
})}`
|
|
1196
|
+
Url: `${baseUrl}?${buildQueryString$1(params)}`
|
|
1725
1197
|
};
|
|
1726
1198
|
},
|
|
1727
1199
|
/**
|
|
@@ -1741,19 +1213,21 @@ const xiaohongshuApiUrls = {
|
|
|
1741
1213
|
* @returns 完整的接口URL
|
|
1742
1214
|
*/
|
|
1743
1215
|
userNoteList(data) {
|
|
1216
|
+
const baseUrl = "https://edith.xiaohongshu.com/api/sns/web/v1/user_posted";
|
|
1217
|
+
const params = {
|
|
1218
|
+
user_id: data.user_id,
|
|
1219
|
+
cursor: data.cursor ?? "",
|
|
1220
|
+
num: data.num ?? 30,
|
|
1221
|
+
image_formats: [
|
|
1222
|
+
"jpg",
|
|
1223
|
+
"webp",
|
|
1224
|
+
"avif"
|
|
1225
|
+
].join(","),
|
|
1226
|
+
xsec_source: "pc_feed"
|
|
1227
|
+
};
|
|
1744
1228
|
return {
|
|
1745
1229
|
apiPath: "/api/sns/web/v1/user_posted",
|
|
1746
|
-
Url:
|
|
1747
|
-
user_id: data.user_id,
|
|
1748
|
-
cursor: data.cursor ?? "",
|
|
1749
|
-
num: data.num ?? 30,
|
|
1750
|
-
image_formats: [
|
|
1751
|
-
"jpg",
|
|
1752
|
-
"webp",
|
|
1753
|
-
"avif"
|
|
1754
|
-
].join(","),
|
|
1755
|
-
xsec_source: "pc_feed"
|
|
1756
|
-
})}`
|
|
1230
|
+
Url: `${baseUrl}?${buildQueryString$1(params)}`
|
|
1757
1231
|
};
|
|
1758
1232
|
},
|
|
1759
1233
|
/**
|
|
@@ -1970,7 +1444,8 @@ const createErrorResponse = (error, message, code = 500, data) => {
|
|
|
1970
1444
|
async function fetchBilibiliInternal(methodType, options, config) {
|
|
1971
1445
|
const startTime = Date.now();
|
|
1972
1446
|
try {
|
|
1973
|
-
const
|
|
1447
|
+
const apiParams = { ...validateBilibiliParams(methodType, options) };
|
|
1448
|
+
const rawData = await fetchBilibili(apiParams, config.cookie, config.requestConfig);
|
|
1974
1449
|
const duration = Date.now() - startTime;
|
|
1975
1450
|
if (rawData.code !== 0) {
|
|
1976
1451
|
const errorMessage = rawData.message || "B站数据获取失败";
|
|
@@ -1982,11 +1457,12 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1982
1457
|
url: void 0,
|
|
1983
1458
|
duration
|
|
1984
1459
|
});
|
|
1985
|
-
|
|
1460
|
+
const amagiError = rawData.amagiError ?? {
|
|
1986
1461
|
errorDescription: errorMessage,
|
|
1987
1462
|
requestType: methodType,
|
|
1988
1463
|
requestUrl: void 0
|
|
1989
|
-
}
|
|
1464
|
+
};
|
|
1465
|
+
return createErrorResponse(amagiError, errorMessage, rawData.code, rawData);
|
|
1990
1466
|
}
|
|
1991
1467
|
const result = createSuccessResponse(rawData, "获取成功", 200);
|
|
1992
1468
|
emitApiSuccess({
|
|
@@ -2293,31 +1769,6 @@ async function fetchDynamicDetail(options, cookie, requestConfig) {
|
|
|
2293
1769
|
requestConfig
|
|
2294
1770
|
});
|
|
2295
1771
|
}
|
|
2296
|
-
/**
|
|
2297
|
-
* 获取B站动态卡片信息
|
|
2298
|
-
*
|
|
2299
|
-
* @deprecated v6.1.3 已废弃,B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口。
|
|
2300
|
-
* 调用将返回错误信息
|
|
2301
|
-
* 计划于 v7.0.0 移除。
|
|
2302
|
-
*
|
|
2303
|
-
* @param options - 动态参数
|
|
2304
|
-
* @param options.dynamic_id - 动态 ID
|
|
2305
|
-
* @param cookie - B站 Cookie (可选)
|
|
2306
|
-
* @param requestConfig - 请求配置 (可选)
|
|
2307
|
-
* @returns 动态卡片数据(已停用,返回错误信息)
|
|
2308
|
-
* @example
|
|
2309
|
-
* ```typescript
|
|
2310
|
-
* const result = await fetchDynamicCard({ dynamic_id: '123456789' }, cookie)
|
|
2311
|
-
* // result.success === false,错误信息提示接口已停用
|
|
2312
|
-
* ```
|
|
2313
|
-
*/
|
|
2314
|
-
async function fetchDynamicCard(options, cookie, requestConfig) {
|
|
2315
|
-
checkDeprecation("fetchDynamicCard");
|
|
2316
|
-
return fetchBilibiliInternal("dynamicCard", options, {
|
|
2317
|
-
cookie,
|
|
2318
|
-
requestConfig
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
1772
|
//#endregion
|
|
2322
1773
|
//#region src/model/fetchers/bilibili/live.ts
|
|
2323
1774
|
/**
|
|
@@ -2636,8 +2087,6 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2636
2087
|
fetchUserSpaceInfo: (options, override) => fetchUserSpaceInfo(options, ...resolveRequest(override)),
|
|
2637
2088
|
fetchUploaderTotalViews: (options, override) => fetchUploaderTotalViews(options, ...resolveRequest(override)),
|
|
2638
2089
|
fetchDynamicDetail: (options, override) => fetchDynamicDetail(options, ...resolveRequest(override)),
|
|
2639
|
-
/** @deprecated v6.1.3 已废弃,调用将返回错误信息 */
|
|
2640
|
-
fetchDynamicCard: (options, override) => fetchDynamicCard(options, ...resolveRequest(override)),
|
|
2641
2090
|
fetchBangumiInfo: (options, override) => fetchBangumiInfo(options, ...resolveRequest(override)),
|
|
2642
2091
|
fetchBangumiStreamUrl: (options, override) => fetchBangumiStreamUrl(options, ...resolveRequest(override)),
|
|
2643
2092
|
fetchLiveRoomInfo: (options, override) => fetchLiveRoomInfo$2(options, ...resolveRequest(override)),
|
|
@@ -2684,7 +2133,6 @@ const bilibiliFetcher = {
|
|
|
2684
2133
|
fetchUserSpaceInfo,
|
|
2685
2134
|
fetchUploaderTotalViews,
|
|
2686
2135
|
fetchDynamicDetail,
|
|
2687
|
-
fetchDynamicCard,
|
|
2688
2136
|
fetchBangumiInfo,
|
|
2689
2137
|
fetchBangumiStreamUrl,
|
|
2690
2138
|
fetchLiveRoomInfo: fetchLiveRoomInfo$2,
|
|
@@ -3066,8 +2514,6 @@ function result_encrypt(long_str, num) {
|
|
|
3066
2514
|
case 3:
|
|
3067
2515
|
temp_int = long_int & 63;
|
|
3068
2516
|
result += constant["str"].charAt(temp_int);
|
|
3069
|
-
break;
|
|
3070
|
-
default: break;
|
|
3071
2517
|
}
|
|
3072
2518
|
}
|
|
3073
2519
|
return result;
|
|
@@ -3569,7 +3015,8 @@ var DouyinAPI = class {
|
|
|
3569
3015
|
}
|
|
3570
3016
|
/** 获取视频或图集数据 */
|
|
3571
3017
|
getWorkDetail(data) {
|
|
3572
|
-
|
|
3018
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/aweme/detail/";
|
|
3019
|
+
const params = {
|
|
3573
3020
|
...this.getBaseParams(),
|
|
3574
3021
|
aweme_id: data.aweme_id,
|
|
3575
3022
|
update_version_code: "170400",
|
|
@@ -3579,11 +3026,13 @@ var DouyinAPI = class {
|
|
|
3579
3026
|
screen_height: "1310",
|
|
3580
3027
|
round_trip_time: "150",
|
|
3581
3028
|
webid: "7351848354471872041"
|
|
3582
|
-
}
|
|
3029
|
+
};
|
|
3030
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3583
3031
|
}
|
|
3584
3032
|
/** 获取评论数据 */
|
|
3585
3033
|
getComments(data) {
|
|
3586
|
-
|
|
3034
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/comment/list/";
|
|
3035
|
+
const params = {
|
|
3587
3036
|
...this.getBaseParams(),
|
|
3588
3037
|
aweme_id: data.aweme_id,
|
|
3589
3038
|
cursor: data.cursor ?? 0,
|
|
@@ -3598,11 +3047,13 @@ var DouyinAPI = class {
|
|
|
3598
3047
|
screen_width: "1552",
|
|
3599
3048
|
screen_height: "970",
|
|
3600
3049
|
round_trip_time: "50"
|
|
3601
|
-
}
|
|
3050
|
+
};
|
|
3051
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3602
3052
|
}
|
|
3603
3053
|
/** 获取二级评论数据 */
|
|
3604
3054
|
getCommentReplies(data) {
|
|
3605
|
-
|
|
3055
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/comment/list/reply/";
|
|
3056
|
+
const params = {
|
|
3606
3057
|
device_platform: "webapp",
|
|
3607
3058
|
aid: "6383",
|
|
3608
3059
|
channel: "channel_pc_web",
|
|
@@ -3640,11 +3091,13 @@ var DouyinAPI = class {
|
|
|
3640
3091
|
webid: "7487210762873685515",
|
|
3641
3092
|
verifyFp: fp,
|
|
3642
3093
|
fp
|
|
3643
|
-
}
|
|
3094
|
+
};
|
|
3095
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3644
3096
|
}
|
|
3645
3097
|
/** 获取动图数据 */
|
|
3646
3098
|
getSlidesInfo(data) {
|
|
3647
|
-
|
|
3099
|
+
const baseUrl = "https://www.iesdouyin.com/web/api/v2/aweme/slidesinfo/";
|
|
3100
|
+
const params = {
|
|
3648
3101
|
reflow_source: "reflow_page",
|
|
3649
3102
|
web_id: "7326472315356857893",
|
|
3650
3103
|
device_id: "7326472315356857893",
|
|
@@ -3653,7 +3106,8 @@ var DouyinAPI = class {
|
|
|
3653
3106
|
msToken: douyinSign.Mstoken(116),
|
|
3654
3107
|
verifyFp: fp,
|
|
3655
3108
|
fp
|
|
3656
|
-
}
|
|
3109
|
+
};
|
|
3110
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3657
3111
|
}
|
|
3658
3112
|
/** 获取表情数据 */
|
|
3659
3113
|
getEmojiList() {
|
|
@@ -3661,7 +3115,8 @@ var DouyinAPI = class {
|
|
|
3661
3115
|
}
|
|
3662
3116
|
/** 获取用户主页视频数据 */
|
|
3663
3117
|
getUserVideoList(data) {
|
|
3664
|
-
|
|
3118
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/aweme/post/";
|
|
3119
|
+
const params = {
|
|
3665
3120
|
...this.getBaseParams(),
|
|
3666
3121
|
sec_user_id: data.sec_uid,
|
|
3667
3122
|
max_cursor: data.max_cursor ?? "0",
|
|
@@ -3679,11 +3134,13 @@ var DouyinAPI = class {
|
|
|
3679
3134
|
screen_height: "970",
|
|
3680
3135
|
round_trip_time: "50",
|
|
3681
3136
|
webid: "7338423850134226495"
|
|
3682
|
-
}
|
|
3137
|
+
};
|
|
3138
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3683
3139
|
}
|
|
3684
3140
|
/** 获取用户喜欢列表数据 */
|
|
3685
3141
|
getUserFavoriteList(data) {
|
|
3686
|
-
|
|
3142
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/";
|
|
3143
|
+
const params = {
|
|
3687
3144
|
...this.getBaseParams(),
|
|
3688
3145
|
sec_user_id: data.sec_uid,
|
|
3689
3146
|
max_cursor: data.max_cursor ?? "0",
|
|
@@ -3702,11 +3159,13 @@ var DouyinAPI = class {
|
|
|
3702
3159
|
screen_height: "1310",
|
|
3703
3160
|
round_trip_time: "0",
|
|
3704
3161
|
webid: "7487210762873685515"
|
|
3705
|
-
}
|
|
3162
|
+
};
|
|
3163
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3706
3164
|
}
|
|
3707
3165
|
/** 获取用户推荐列表数据 */
|
|
3708
3166
|
getUserRecommendList(data) {
|
|
3709
|
-
|
|
3167
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/";
|
|
3168
|
+
const params = {
|
|
3710
3169
|
device_platform: "",
|
|
3711
3170
|
aid: "6383",
|
|
3712
3171
|
channel: "channel_pc_web",
|
|
@@ -3745,11 +3204,13 @@ var DouyinAPI = class {
|
|
|
3745
3204
|
msToken: douyinSign.Mstoken(184),
|
|
3746
3205
|
verifyFp: fp,
|
|
3747
3206
|
fp
|
|
3748
|
-
}
|
|
3207
|
+
};
|
|
3208
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3749
3209
|
}
|
|
3750
3210
|
/** 获取用户主页信息 */
|
|
3751
3211
|
getUserProfile(data) {
|
|
3752
|
-
|
|
3212
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/user/profile/other/";
|
|
3213
|
+
const params = {
|
|
3753
3214
|
...this.getBaseParams(),
|
|
3754
3215
|
publish_video_strategy_type: "2",
|
|
3755
3216
|
source: "channel_pc_web",
|
|
@@ -3761,11 +3222,13 @@ var DouyinAPI = class {
|
|
|
3761
3222
|
screen_height: "970",
|
|
3762
3223
|
round_trip_time: "0",
|
|
3763
3224
|
webid: "7327957959955580467"
|
|
3764
|
-
}
|
|
3225
|
+
};
|
|
3226
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3765
3227
|
}
|
|
3766
3228
|
/** 获取热点词数据 */
|
|
3767
3229
|
getSuggestWords(data) {
|
|
3768
|
-
|
|
3230
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/api/suggest_words/";
|
|
3231
|
+
const params = {
|
|
3769
3232
|
...this.getBaseParams(),
|
|
3770
3233
|
query: data.query,
|
|
3771
3234
|
business_id: "30088",
|
|
@@ -3776,91 +3239,103 @@ var DouyinAPI = class {
|
|
|
3776
3239
|
screen_height: "970",
|
|
3777
3240
|
round_trip_time: "50",
|
|
3778
3241
|
webid: "7327957959955580467"
|
|
3779
|
-
}
|
|
3242
|
+
};
|
|
3243
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3780
3244
|
}
|
|
3781
3245
|
/** 获取搜索数据 */
|
|
3782
3246
|
search(data) {
|
|
3783
3247
|
const searchType = data.type ?? "general";
|
|
3784
3248
|
const { verifyFp, fp, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3785
|
-
if (searchType === "user")
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3249
|
+
if (searchType === "user") {
|
|
3250
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/discover/search/";
|
|
3251
|
+
const params = {
|
|
3252
|
+
...baseParamsWithoutFp,
|
|
3253
|
+
count: data.number ?? 10,
|
|
3254
|
+
disable_rs: "0",
|
|
3255
|
+
from_group_id: "",
|
|
3256
|
+
is_filter_search: "0",
|
|
3257
|
+
keyword: data.query,
|
|
3258
|
+
list_type: "single",
|
|
3259
|
+
need_filter_settings: "1",
|
|
3260
|
+
offset: "0",
|
|
3261
|
+
pc_libra_divert: "Windows",
|
|
3262
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3263
|
+
query_correct_type: "1",
|
|
3264
|
+
round_trip_time: "250",
|
|
3265
|
+
screen_height: "1310",
|
|
3266
|
+
screen_width: "2328",
|
|
3267
|
+
search_channel: "aweme_user_web",
|
|
3268
|
+
search_source: "switch_tab",
|
|
3269
|
+
support_dash: "1",
|
|
3270
|
+
support_h265: "1",
|
|
3271
|
+
version_code: "170400",
|
|
3272
|
+
version_name: "17.4.0",
|
|
3273
|
+
webid: "7521399115230610959",
|
|
3274
|
+
...data.search_id && { search_id: data.search_id }
|
|
3275
|
+
};
|
|
3276
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3277
|
+
} else if (searchType === "video") {
|
|
3278
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/search/item/";
|
|
3279
|
+
const params = {
|
|
3280
|
+
...baseParamsWithoutFp,
|
|
3281
|
+
count: data.number ?? 10,
|
|
3282
|
+
disable_rs: "0",
|
|
3283
|
+
enable_history: "1",
|
|
3284
|
+
from_group_id: "",
|
|
3285
|
+
is_filter_search: "0",
|
|
3286
|
+
keyword: data.query,
|
|
3287
|
+
list_type: "single",
|
|
3288
|
+
need_filter_settings: "1",
|
|
3289
|
+
offset: "0",
|
|
3290
|
+
pc_libra_divert: "Windows",
|
|
3291
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3292
|
+
query_correct_type: "1",
|
|
3293
|
+
round_trip_time: "50",
|
|
3294
|
+
screen_height: "1310",
|
|
3295
|
+
screen_width: "2328",
|
|
3296
|
+
search_channel: "aweme_video_web",
|
|
3297
|
+
search_source: "switch_tab",
|
|
3298
|
+
support_dash: "1",
|
|
3299
|
+
support_h265: "1",
|
|
3300
|
+
version_code: "170400",
|
|
3301
|
+
version_name: "17.4.0",
|
|
3302
|
+
webid: "7521399115230610959",
|
|
3303
|
+
...data.search_id && { search_id: data.search_id }
|
|
3304
|
+
};
|
|
3305
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3306
|
+
} else {
|
|
3307
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/general/search/stream/";
|
|
3308
|
+
const params = {
|
|
3309
|
+
...baseParamsWithoutFp,
|
|
3310
|
+
count: data.number ?? 10,
|
|
3311
|
+
disable_rs: "0",
|
|
3312
|
+
enable_history: "1",
|
|
3313
|
+
is_filter_search: "0",
|
|
3314
|
+
keyword: data.query,
|
|
3315
|
+
list_type: "",
|
|
3316
|
+
need_filter_settings: "1",
|
|
3317
|
+
offset: "0",
|
|
3318
|
+
pc_libra_divert: "Windows",
|
|
3319
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3320
|
+
query_correct_type: "1",
|
|
3321
|
+
round_trip_time: "0",
|
|
3322
|
+
screen_height: "1310",
|
|
3323
|
+
screen_width: "2328",
|
|
3324
|
+
search_channel: "aweme_general",
|
|
3325
|
+
search_source: "normal_search",
|
|
3326
|
+
support_dash: "1",
|
|
3327
|
+
support_h265: "1",
|
|
3328
|
+
version_code: "190600",
|
|
3329
|
+
version_name: "19.6.0",
|
|
3330
|
+
webid: "7521399115230610959"
|
|
3331
|
+
};
|
|
3332
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3333
|
+
}
|
|
3860
3334
|
}
|
|
3861
3335
|
/** 获取互动表情数据 */
|
|
3862
3336
|
getDynamicEmojiList() {
|
|
3863
|
-
|
|
3337
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/im/strategy/config";
|
|
3338
|
+
const params = {
|
|
3864
3339
|
device_platform: "webapp",
|
|
3865
3340
|
aid: "1128",
|
|
3866
3341
|
channel: "channel_pc_web",
|
|
@@ -3892,11 +3367,13 @@ var DouyinAPI = class {
|
|
|
3892
3367
|
msToken: douyinSign.Mstoken(116),
|
|
3893
3368
|
verifyFp: fp,
|
|
3894
3369
|
fp
|
|
3895
|
-
}
|
|
3370
|
+
};
|
|
3371
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3896
3372
|
}
|
|
3897
3373
|
/** 获取背景音乐数据 */
|
|
3898
3374
|
getMusicInfo(data) {
|
|
3899
|
-
|
|
3375
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/music/detail/";
|
|
3376
|
+
const params = {
|
|
3900
3377
|
device_platform: "webapp",
|
|
3901
3378
|
aid: "6383",
|
|
3902
3379
|
channel: "channel_pc_web",
|
|
@@ -3927,11 +3404,13 @@ var DouyinAPI = class {
|
|
|
3927
3404
|
msToken: douyinSign.Mstoken(116),
|
|
3928
3405
|
verifyFp: fp,
|
|
3929
3406
|
fp
|
|
3930
|
-
}
|
|
3407
|
+
};
|
|
3408
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3931
3409
|
}
|
|
3932
3410
|
/** 获取直播间信息 */
|
|
3933
3411
|
getLiveRoomInfo(data) {
|
|
3934
|
-
|
|
3412
|
+
const baseUrl = "https://live.douyin.com/webcast/room/web/enter/";
|
|
3413
|
+
const params = {
|
|
3935
3414
|
aid: "6383",
|
|
3936
3415
|
app_name: "douyin_web",
|
|
3937
3416
|
live_id: "1",
|
|
@@ -3954,18 +3433,22 @@ var DouyinAPI = class {
|
|
|
3954
3433
|
msToken: douyinSign.Mstoken(116),
|
|
3955
3434
|
verifyFp: fp,
|
|
3956
3435
|
fp
|
|
3957
|
-
}
|
|
3436
|
+
};
|
|
3437
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3958
3438
|
}
|
|
3959
3439
|
/** 申请登录二维码 */
|
|
3960
3440
|
getLoginQrcode(data) {
|
|
3961
|
-
|
|
3441
|
+
const baseUrl = "https://sso.douyin.com/get_qrcode/";
|
|
3442
|
+
const params = {
|
|
3962
3443
|
verifyFp: data.verify_fp,
|
|
3963
3444
|
fp: data.verify_fp
|
|
3964
|
-
}
|
|
3445
|
+
};
|
|
3446
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3965
3447
|
}
|
|
3966
3448
|
/** 获取弹幕数据 */
|
|
3967
3449
|
getDanmakuList(data) {
|
|
3968
|
-
|
|
3450
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/danmaku/get_v2/";
|
|
3451
|
+
const params = {
|
|
3969
3452
|
...this.getBaseParams(),
|
|
3970
3453
|
app_name: "aweme",
|
|
3971
3454
|
format: "json",
|
|
@@ -3992,7 +3475,8 @@ var DouyinAPI = class {
|
|
|
3992
3475
|
msToken: douyinSign.Mstoken(116),
|
|
3993
3476
|
verifyFp: fp,
|
|
3994
3477
|
fp
|
|
3995
|
-
}
|
|
3478
|
+
};
|
|
3479
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3996
3480
|
}
|
|
3997
3481
|
};
|
|
3998
3482
|
/**
|
|
@@ -4014,7 +3498,6 @@ const douyinApiUrls = new DouyinAPI();
|
|
|
4014
3498
|
* 提供抖音各类数据的获取功能,包括视频、评论、用户等
|
|
4015
3499
|
*
|
|
4016
3500
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
4017
|
-
* 循环依赖链:DataFetchers → getdata → platform/douyin → DataFetchers
|
|
4018
3501
|
*
|
|
4019
3502
|
* @module platform/douyin/getdata
|
|
4020
3503
|
*/
|
|
@@ -4291,7 +3774,8 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4291
3774
|
signType: null,
|
|
4292
3775
|
processRawResponse: (raw) => {
|
|
4293
3776
|
if (!isUserSearch && !isVideoSearch) {
|
|
4294
|
-
const
|
|
3777
|
+
const chunks = typeof raw === "string" ? parseDouyinMultiJson(raw) : [raw];
|
|
3778
|
+
const responses = filterSearchResponses(chunks);
|
|
4295
3779
|
if (responses.length === 0) return raw;
|
|
4296
3780
|
const mergedData = [];
|
|
4297
3781
|
let lastValid = {};
|
|
@@ -4670,7 +4154,8 @@ const filterSearchResponses = (objs) => {
|
|
|
4670
4154
|
async function fetchDouyinInternal(methodType, options, config) {
|
|
4671
4155
|
const startTime = Date.now();
|
|
4672
4156
|
try {
|
|
4673
|
-
const
|
|
4157
|
+
const apiParams = { ...validateDouyinParams(methodType, options) };
|
|
4158
|
+
const rawData = await DouyinData(apiParams, config.cookie, config.requestConfig);
|
|
4674
4159
|
const duration = Date.now() - startTime;
|
|
4675
4160
|
if (rawData.data === "" || rawData.status_code !== 0) {
|
|
4676
4161
|
emitApiError({
|
|
@@ -5278,11 +4763,13 @@ var API = class {
|
|
|
5278
4763
|
* @returns 请求配置
|
|
5279
4764
|
*/
|
|
5280
4765
|
profilePublic(data) {
|
|
4766
|
+
const count = "count" in data ? data.count ?? 12 : 12;
|
|
4767
|
+
const pcursor = "pcursor" in data ? data.pcursor ?? "" : "";
|
|
5281
4768
|
return createKuaishouLiveApiRequest("profilePublic", "/live_api/profile/public", {
|
|
5282
4769
|
caver: 2,
|
|
5283
|
-
count
|
|
4770
|
+
count,
|
|
5284
4771
|
hasMore: true,
|
|
5285
|
-
pcursor
|
|
4772
|
+
pcursor,
|
|
5286
4773
|
principalId: data.principalId,
|
|
5287
4774
|
privacy: "public"
|
|
5288
4775
|
}, { signPath: "/rest/k/feed/profile" });
|
|
@@ -5446,6 +4933,7 @@ var API = class {
|
|
|
5446
4933
|
* @returns 请求配置
|
|
5447
4934
|
*/
|
|
5448
4935
|
liveReco(gameId) {
|
|
4936
|
+
const normalizedGameId = Number(gameId) > 0 ? Number(gameId) : 1001;
|
|
5449
4937
|
return createKuaishouLiveApiRequest("liveReco", "/live_api/liveroom/reco", {}, {
|
|
5450
4938
|
method: "POST",
|
|
5451
4939
|
requiresSign: false,
|
|
@@ -5455,7 +4943,7 @@ var API = class {
|
|
|
5455
4943
|
followingWeight: 50
|
|
5456
4944
|
},
|
|
5457
4945
|
gameFavour: [{
|
|
5458
|
-
gameId:
|
|
4946
|
+
gameId: normalizedGameId,
|
|
5459
4947
|
totalStayLength: 100
|
|
5460
4948
|
}]
|
|
5461
4949
|
}
|
|
@@ -5688,8 +5176,10 @@ const maskKuaishouHudrPayload = (payload) => {
|
|
|
5688
5176
|
* @returns `HUDR_` 的完整结果及若干中间态,便于对拍与调试
|
|
5689
5177
|
*/
|
|
5690
5178
|
const deriveKuaishouHudrBody = (context) => {
|
|
5691
|
-
const
|
|
5692
|
-
const
|
|
5179
|
+
const payload = buildKuaishouHudrPayload(context);
|
|
5180
|
+
const maskedPayload = maskKuaishouHudrPayload(payload);
|
|
5181
|
+
const encrypted = new KuaishouChaChaCipher(KUAISHOU_HUDR_CHACHA_KEY, KUAISHOU_HUDR_CHACHA_NONCE).encrypt(maskedPayload);
|
|
5182
|
+
const body = encodeBase64Url(encrypted);
|
|
5693
5183
|
return {
|
|
5694
5184
|
body,
|
|
5695
5185
|
full: `${KUAISHOU_HUDR_PREFIX}${body}`,
|
|
@@ -6201,7 +5691,9 @@ const KUAISHOU_HE_RANDOM_MAX = 0xffffffffffff;
|
|
|
6201
5691
|
* @returns `$HE_` 载荷中的 4 字节 hash field hex
|
|
6202
5692
|
*/
|
|
6203
5693
|
const deriveKuaishouHeHashFieldHex = (signInput, hudrBody) => {
|
|
6204
|
-
|
|
5694
|
+
const hashInput = `${signInput}HUDR_${hudrBody}`;
|
|
5695
|
+
const digestHex = bytesToLowerHex(deriveKuaishouCts(deriveKuaishouB2sa(hashInput))).slice(0, 8);
|
|
5696
|
+
return bytesToLowerHex(xorByteArrays(hexToSignedBytes(digestHex), KUAISHOU_HE_INPUT_XOR_MASK));
|
|
6205
5697
|
};
|
|
6206
5698
|
/**
|
|
6207
5699
|
* 推导快手签名中的 `$HE_` 段。
|
|
@@ -6541,7 +6033,6 @@ var kuaishouSign = class {
|
|
|
6541
6033
|
* 快手数据获取模块
|
|
6542
6034
|
*
|
|
6543
6035
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
6544
|
-
* 循环依赖链:DataFetchers → getdata → platform/kuaishou → DataFetchers
|
|
6545
6036
|
*/
|
|
6546
6037
|
const KUAISHOU_PROFILE_TAB_TYPE_MAP = {
|
|
6547
6038
|
public: "public",
|
|
@@ -7223,7 +6714,8 @@ const KuaishouData = async (data, cookie, requestConfig) => {
|
|
|
7223
6714
|
if (!liveDetailData) return liveRoomInfo;
|
|
7224
6715
|
const userInfo = isErrorDetailLike(userInfoPayload) ? void 0 : userInfoPayload?.data?.userInfo;
|
|
7225
6716
|
const sensitiveInfo = isErrorDetailLike(sensitivePayload) ? void 0 : sensitivePayload?.data?.sensitiveUserInfo;
|
|
7226
|
-
const
|
|
6717
|
+
const currentAuthor = mergeKuaishouLiveAuthor(liveDetailData?.author, userInfo, sensitiveInfo);
|
|
6718
|
+
const currentLiveRoomItem = mapLiveDetailToLiveRoomPlayItem(liveDetailData, currentAuthor);
|
|
7227
6719
|
const liveStreamId = currentLiveRoomItem.liveStream?.id ?? currentLiveRoomItem.config?.liveStreamId;
|
|
7228
6720
|
const currentGameId = liveDetailData?.gameInfo?.id ?? liveDetailData?.gameInfo?.gameId;
|
|
7229
6721
|
const liveDetailWebsocketMeta = resolveKuaishouLiveDetailWebsocketMeta(liveDetailData);
|
|
@@ -7241,7 +6733,8 @@ const KuaishouData = async (data, cookie, requestConfig) => {
|
|
|
7241
6733
|
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveReco(currentGameId), refererPath, { allowResult2: true }) : Promise.resolve(null)
|
|
7242
6734
|
]);
|
|
7243
6735
|
const resolvedRecommendList = !isErrorDetailLike(recoPayload) && Array.isArray(recoPayload?.data?.list) ? recoPayload.data.list : liveDetailRecommendList;
|
|
7244
|
-
const
|
|
6736
|
+
const recoPlayList = Array.isArray(resolvedRecommendList) ? resolvedRecommendList.map((item) => mapRecoItemToLiveRoomPlayItem(item)) : [];
|
|
6737
|
+
const nextPlayList = dedupeLiveRoomPlayList([currentLiveRoomItem, ...recoPlayList]);
|
|
7245
6738
|
return {
|
|
7246
6739
|
...liveRoomInfo,
|
|
7247
6740
|
principalId: data.principalId,
|
|
@@ -7352,7 +6845,8 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7352
6845
|
async function fetchKuaishouInternal(methodType, options, config) {
|
|
7353
6846
|
const startTime = Date.now();
|
|
7354
6847
|
try {
|
|
7355
|
-
const
|
|
6848
|
+
const apiParams = { ...validateKuaishouParams(methodType, options) };
|
|
6849
|
+
const rawData = await KuaishouData(apiParams, config.cookie, config.requestConfig);
|
|
7356
6850
|
const duration = Date.now() - startTime;
|
|
7357
6851
|
if (rawData.code && Object.values(kuaishouAPIErrorCode).includes(rawData.code)) {
|
|
7358
6852
|
emitApiError({
|
|
@@ -7611,18 +7105,19 @@ const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
|
7611
7105
|
...requestConfig?.headers ?? {}
|
|
7612
7106
|
}
|
|
7613
7107
|
};
|
|
7108
|
+
const userData = await GlobalGetData$1(data.methodType, {
|
|
7109
|
+
...baseRequestConfig,
|
|
7110
|
+
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7111
|
+
headers: {
|
|
7112
|
+
...baseRequestConfig.headers,
|
|
7113
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7114
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7115
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7116
|
+
}
|
|
7117
|
+
});
|
|
7614
7118
|
return {
|
|
7615
7119
|
code: 0,
|
|
7616
|
-
data: extractCreatorInfoFromHtml(
|
|
7617
|
-
...baseRequestConfig,
|
|
7618
|
-
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7619
|
-
headers: {
|
|
7620
|
-
...baseRequestConfig.headers,
|
|
7621
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7622
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7623
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7624
|
-
}
|
|
7625
|
-
})),
|
|
7120
|
+
data: extractCreatorInfoFromHtml(userData),
|
|
7626
7121
|
msg: "success"
|
|
7627
7122
|
};
|
|
7628
7123
|
}
|
|
@@ -7736,7 +7231,8 @@ const sortTypeMapping = {
|
|
|
7736
7231
|
async function fetchXiaohongshuInternal(methodType, options, config) {
|
|
7737
7232
|
const startTime = Date.now();
|
|
7738
7233
|
try {
|
|
7739
|
-
const
|
|
7234
|
+
const apiParams = { ...validateXiaohongshuParams(methodType, options) };
|
|
7235
|
+
const rawData = await XiaohongshuData(apiParams, config.cookie, config.requestConfig);
|
|
7740
7236
|
const duration = Date.now() - startTime;
|
|
7741
7237
|
if (rawData.code && Object.values(xiaohongshuAPIErrorCode).includes(rawData.code)) {
|
|
7742
7238
|
emitApiError({
|
|
@@ -8160,106 +7656,6 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
8160
7656
|
};
|
|
8161
7657
|
};
|
|
8162
7658
|
//#endregion
|
|
8163
|
-
//#region src/model/logger.ts
|
|
8164
|
-
/**
|
|
8165
|
-
* @deprecated v6 已废弃日志模块,请使用事件系统替代
|
|
8166
|
-
* @see {@link ../events.ts} 使用 amagiEvents 监听日志事件
|
|
8167
|
-
*
|
|
8168
|
-
* 迁移示例:
|
|
8169
|
-
* ```typescript
|
|
8170
|
-
* import { amagiEvents } from '@ikenxuan/amagi'
|
|
8171
|
-
*
|
|
8172
|
-
* amagiEvents.on('log:info', (data) => console.log(data.message))
|
|
8173
|
-
* amagiEvents.on('log:error', (data) => console.error(data.message))
|
|
8174
|
-
* ```
|
|
8175
|
-
*/
|
|
8176
|
-
/**
|
|
8177
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8178
|
-
* 初始化 logger 配置 - 此函数现在为空操作
|
|
8179
|
-
*/
|
|
8180
|
-
const initLogger = () => {};
|
|
8181
|
-
/**
|
|
8182
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8183
|
-
* 简化的日志类,仅发射事件,不再依赖 log4js
|
|
8184
|
-
*/
|
|
8185
|
-
var SimpleLogger = class {
|
|
8186
|
-
chalk;
|
|
8187
|
-
red;
|
|
8188
|
-
green;
|
|
8189
|
-
yellow;
|
|
8190
|
-
blue;
|
|
8191
|
-
magenta;
|
|
8192
|
-
cyan;
|
|
8193
|
-
white;
|
|
8194
|
-
gray;
|
|
8195
|
-
constructor() {
|
|
8196
|
-
this.chalk = new chalk.Chalk();
|
|
8197
|
-
this.red = this.chalk.red;
|
|
8198
|
-
this.green = this.chalk.green;
|
|
8199
|
-
this.yellow = this.chalk.yellow;
|
|
8200
|
-
this.blue = this.chalk.blue;
|
|
8201
|
-
this.magenta = this.chalk.magenta;
|
|
8202
|
-
this.cyan = this.chalk.cyan;
|
|
8203
|
-
this.white = this.chalk.white;
|
|
8204
|
-
this.gray = this.chalk.gray;
|
|
8205
|
-
}
|
|
8206
|
-
info(message, ...args) {
|
|
8207
|
-
emitLog("info", String(message), ...args);
|
|
8208
|
-
}
|
|
8209
|
-
warn(message, ...args) {
|
|
8210
|
-
emitLog("warn", String(message), ...args);
|
|
8211
|
-
}
|
|
8212
|
-
error(message, ...args) {
|
|
8213
|
-
emitLog("error", String(message), ...args);
|
|
8214
|
-
}
|
|
8215
|
-
mark(message, ...args) {
|
|
8216
|
-
emitLog("mark", String(message), ...args);
|
|
8217
|
-
}
|
|
8218
|
-
debug(message, ...args) {
|
|
8219
|
-
emitLog("debug", String(message), ...args);
|
|
8220
|
-
}
|
|
8221
|
-
};
|
|
8222
|
-
/**
|
|
8223
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8224
|
-
*/
|
|
8225
|
-
const logger = new SimpleLogger();
|
|
8226
|
-
/**
|
|
8227
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8228
|
-
*/
|
|
8229
|
-
const httpLogger = new SimpleLogger();
|
|
8230
|
-
/**
|
|
8231
|
-
* @deprecated v6 已废弃,请使用事件系统监听 http:response 事件
|
|
8232
|
-
* 创建一个日志中间件,用于记录特定请求的详细信息
|
|
8233
|
-
* @param pathsToLog 指定需要记录日志的请求路径数组如果未提供,则记录所有请求的日志
|
|
8234
|
-
* @returns
|
|
8235
|
-
*/
|
|
8236
|
-
const logMiddleware = (pathsToLog) => {
|
|
8237
|
-
return (req, res, next) => {
|
|
8238
|
-
if (!pathsToLog || pathsToLog.some((path) => req.url.startsWith(path))) {
|
|
8239
|
-
const startTime = Date.now();
|
|
8240
|
-
const url = req.url;
|
|
8241
|
-
const method = req.method;
|
|
8242
|
-
const clientIP = req.headers["x-forwarded-for"] ?? req.socket.remoteAddress;
|
|
8243
|
-
res.on("finish", () => {
|
|
8244
|
-
const responseTime = Date.now() - startTime;
|
|
8245
|
-
const statusCode = res.statusCode;
|
|
8246
|
-
const requestSize = req.headers["content-length"] ?? "0";
|
|
8247
|
-
const responseSize = res.get("content-length") ?? "0";
|
|
8248
|
-
emitHttpResponse({
|
|
8249
|
-
method,
|
|
8250
|
-
url,
|
|
8251
|
-
statusCode,
|
|
8252
|
-
responseTime,
|
|
8253
|
-
clientIP: String(clientIP),
|
|
8254
|
-
requestSize: `${requestSize}B`,
|
|
8255
|
-
responseSize: `${responseSize}B`
|
|
8256
|
-
});
|
|
8257
|
-
});
|
|
8258
|
-
}
|
|
8259
|
-
next();
|
|
8260
|
-
};
|
|
8261
|
-
};
|
|
8262
|
-
//#endregion
|
|
8263
7659
|
//#region src/platform/bilibili/qtparam.ts
|
|
8264
7660
|
/**
|
|
8265
7661
|
* 生成B站视频流请求参数
|
|
@@ -8578,7 +7974,6 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8578
7974
|
* 提供 B站各类数据的获取功能,包括视频、评论、用户、番剧等
|
|
8579
7975
|
*
|
|
8580
7976
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
8581
|
-
* 循环依赖链:DataFetchers → getdata → platform/bilibili → DataFetchers
|
|
8582
7977
|
*
|
|
8583
7978
|
* @module platform/bilibili/getdata
|
|
8584
7979
|
*/
|
|
@@ -8598,10 +7993,11 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8598
7993
|
url: bilibiliApiUrls.getVideoInfo({ bvid: data.bvid })
|
|
8599
7994
|
});
|
|
8600
7995
|
case "videoStream": {
|
|
8601
|
-
const
|
|
7996
|
+
const baseUrl = bilibiliApiUrls.getVideoStream({
|
|
8602
7997
|
avid: data.avid,
|
|
8603
7998
|
cid: data.cid
|
|
8604
|
-
})
|
|
7999
|
+
});
|
|
8000
|
+
const sign = await qtparam(baseUrl, baseRequestConfig.headers?.Cookie);
|
|
8605
8001
|
return await GlobalGetData(data.methodType, {
|
|
8606
8002
|
...baseRequestConfig,
|
|
8607
8003
|
url: bilibiliApiUrls.getVideoStream({
|
|
@@ -8688,10 +8084,11 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8688
8084
|
});
|
|
8689
8085
|
}
|
|
8690
8086
|
case "bangumiStream": {
|
|
8691
|
-
const
|
|
8087
|
+
const baseUrl = bilibiliApiUrls.getBangumiStream({
|
|
8692
8088
|
cid: data.cid,
|
|
8693
8089
|
ep_id: data.ep_id.replace("ep", "")
|
|
8694
|
-
})
|
|
8090
|
+
});
|
|
8091
|
+
const sign = await qtparam(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8695
8092
|
return await GlobalGetData(data.methodType, {
|
|
8696
8093
|
...baseRequestConfig,
|
|
8697
8094
|
url: bilibiliApiUrls.getBangumiStream({
|
|
@@ -8727,12 +8124,6 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8727
8124
|
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data.dynamic_id })
|
|
8728
8125
|
});
|
|
8729
8126
|
}
|
|
8730
|
-
case "dynamicCard": return {
|
|
8731
|
-
code: -404,
|
|
8732
|
-
message: "接口已停用:B站官方已于 `2025-08-09` 删除 dynamic_svr 接口,fetchDynamicCard 方法已废弃,调用讲返回错误信息",
|
|
8733
|
-
ttl: 1,
|
|
8734
|
-
data: null
|
|
8735
|
-
};
|
|
8736
8127
|
case "userCard": {
|
|
8737
8128
|
const { host_mid } = data;
|
|
8738
8129
|
return await GlobalGetData(data.methodType, {
|
|
@@ -8745,7 +8136,8 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8745
8136
|
url: bilibiliApiUrls.getUserLiveStatus({ host_mid: data.host_mid })
|
|
8746
8137
|
});
|
|
8747
8138
|
case "userSpaceInfo": {
|
|
8748
|
-
const
|
|
8139
|
+
const baseUrl = bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid });
|
|
8140
|
+
const wbiSignQuery = await wbi_sign(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8749
8141
|
return await GlobalGetData(data.methodType, {
|
|
8750
8142
|
...baseRequestConfig,
|
|
8751
8143
|
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }) + wbiSignQuery
|
|
@@ -9096,10 +8488,11 @@ var ValidationError = class ValidationError extends Error {
|
|
|
9096
8488
|
* @returns 验证错误实例
|
|
9097
8489
|
*/
|
|
9098
8490
|
static fromZodError(zodError, requestPath) {
|
|
9099
|
-
|
|
8491
|
+
const errors = zodError.issues.map((err) => ({
|
|
9100
8492
|
field: err.path.join("."),
|
|
9101
8493
|
message: err.message
|
|
9102
|
-
}))
|
|
8494
|
+
}));
|
|
8495
|
+
return new ValidationError("参数验证失败", errors, requestPath);
|
|
9103
8496
|
}
|
|
9104
8497
|
};
|
|
9105
8498
|
/**
|
|
@@ -9123,7 +8516,10 @@ const handleError = (error, requestPath) => {
|
|
|
9123
8516
|
platform: error.platform,
|
|
9124
8517
|
requestPath
|
|
9125
8518
|
};
|
|
9126
|
-
if (error instanceof zod.default.ZodError)
|
|
8519
|
+
if (error instanceof zod.default.ZodError) {
|
|
8520
|
+
const validationError = ValidationError.fromZodError(error, requestPath);
|
|
8521
|
+
return handleError(validationError, requestPath);
|
|
8522
|
+
}
|
|
9127
8523
|
return {
|
|
9128
8524
|
code: 500,
|
|
9129
8525
|
message: error instanceof Error ? error.message : "未知错误",
|
|
@@ -9234,71 +8630,7 @@ const bilibiliUtils = {
|
|
|
9234
8630
|
bv2av
|
|
9235
8631
|
},
|
|
9236
8632
|
danmaku: { parseDmSegMobileReply },
|
|
9237
|
-
bilibiliApiUrls
|
|
9238
|
-
api: bilibili
|
|
9239
|
-
};
|
|
9240
|
-
//#endregion
|
|
9241
|
-
//#region src/platform/douyin/DouyinApi.ts
|
|
9242
|
-
/**
|
|
9243
|
-
* 创建废弃的 API 存根函数
|
|
9244
|
-
*/
|
|
9245
|
-
const createDeprecatedStub$2 = (methodName) => {
|
|
9246
|
-
return (..._args) => {
|
|
9247
|
-
checkDeprecation("getDouyinData");
|
|
9248
|
-
throw new Error(`douyin.${methodName} 已废弃,请使用 douyinFetcher 替代`);
|
|
9249
|
-
};
|
|
9250
|
-
};
|
|
9251
|
-
/**
|
|
9252
|
-
* 封装了所有抖音相关的API请求,采用对象化的方式组织。
|
|
9253
|
-
*
|
|
9254
|
-
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
9255
|
-
*/
|
|
9256
|
-
const douyin = {
|
|
9257
|
-
/** @deprecated 请使用 douyinFetcher.fetchTextWork 替代 */
|
|
9258
|
-
getTextWorkInfo: createDeprecatedStub$2("getTextWorkInfo"),
|
|
9259
|
-
/** @deprecated 请使用 douyinFetcher.parseWork 替代 */
|
|
9260
|
-
getWorkInfo: createDeprecatedStub$2("getWorkInfo"),
|
|
9261
|
-
/** @deprecated 请使用 douyinFetcher.fetchVideoWork 替代 */
|
|
9262
|
-
getVideoWorkInfo: createDeprecatedStub$2("getVideoWorkInfo"),
|
|
9263
|
-
/** @deprecated 请使用 douyinFetcher.fetchImageAlbumWork 替代 */
|
|
9264
|
-
getImageAlbumWorkInfo: createDeprecatedStub$2("getImageAlbumWorkInfo"),
|
|
9265
|
-
/** @deprecated 请使用 douyinFetcher.fetchSlidesWork 替代 */
|
|
9266
|
-
getSlidesWorkInfo: createDeprecatedStub$2("getSlidesWorkInfo"),
|
|
9267
|
-
/** @deprecated 请使用 douyinFetcher.fetchComments 替代 */
|
|
9268
|
-
getComments: createDeprecatedStub$2("getComments"),
|
|
9269
|
-
/** @deprecated 请使用 douyinFetcher.fetchCommentReplies 替代 */
|
|
9270
|
-
getCommentReplies: createDeprecatedStub$2("getCommentReplies"),
|
|
9271
|
-
/** @deprecated 请使用 douyinFetcher.fetchUserProfile 替代 */
|
|
9272
|
-
getUserProfile: createDeprecatedStub$2("getUserProfile"),
|
|
9273
|
-
/** @deprecated 请使用 douyinFetcher.fetchEmojiList 替代 */
|
|
9274
|
-
getEmojiList: createDeprecatedStub$2("getEmojiList"),
|
|
9275
|
-
/** @deprecated 请使用 douyinFetcher.fetchDynamicEmojiList 替代 */
|
|
9276
|
-
getEmojiProList: createDeprecatedStub$2("getEmojiProList"),
|
|
9277
|
-
/** @deprecated 请使用 douyinFetcher.fetchUserVideoList 替代 */
|
|
9278
|
-
getUserVideos: createDeprecatedStub$2("getUserVideos"),
|
|
9279
|
-
/** @deprecated 请使用 douyinFetcher.fetchMusicInfo 替代 */
|
|
9280
|
-
getMusicInfo: createDeprecatedStub$2("getMusicInfo"),
|
|
9281
|
-
/** @deprecated 请使用 douyinFetcher.fetchSuggestWords 替代 */
|
|
9282
|
-
getSuggestWords: createDeprecatedStub$2("getSuggestWords"),
|
|
9283
|
-
/** @deprecated 请使用 douyinFetcher.searchContent 替代 */
|
|
9284
|
-
search: createDeprecatedStub$2("search"),
|
|
9285
|
-
/** @deprecated 请使用 douyinFetcher.fetchLiveRoomInfo 替代 */
|
|
9286
|
-
getLiveRoomInfo: createDeprecatedStub$2("getLiveRoomInfo"),
|
|
9287
|
-
/** @deprecated 请使用 douyinFetcher.fetchDanmakuList 替代 */
|
|
9288
|
-
getDanmaku: createDeprecatedStub$2("getDanmaku"),
|
|
9289
|
-
/** @deprecated 请使用 douyinFetcher 的具体方法替代 */
|
|
9290
|
-
invoke: createDeprecatedStub$2("invoke")
|
|
9291
|
-
};
|
|
9292
|
-
/**
|
|
9293
|
-
* 创建绑定了cookie的抖音API对象
|
|
9294
|
-
*
|
|
9295
|
-
* @deprecated v6 已废弃,请使用 createBoundDouyinFetcher 替代
|
|
9296
|
-
*/
|
|
9297
|
-
const createBoundDouyinApi = (_cookie, _requestConfig) => {
|
|
9298
|
-
return {
|
|
9299
|
-
...douyin,
|
|
9300
|
-
getSearchData: createDeprecatedStub$2("getSearchData")
|
|
9301
|
-
};
|
|
8633
|
+
bilibiliApiUrls
|
|
9302
8634
|
};
|
|
9303
8635
|
//#endregion
|
|
9304
8636
|
//#region src/platform/douyin/routes.ts
|
|
@@ -9352,46 +8684,7 @@ const createDouyinRoutes = (cookie, requestConfig = getDouyinDefaultConfig(cooki
|
|
|
9352
8684
|
/** 抖音相关功能模块 (工具集) */
|
|
9353
8685
|
const douyinUtils = {
|
|
9354
8686
|
sign: douyinSign,
|
|
9355
|
-
douyinApiUrls
|
|
9356
|
-
api: douyin
|
|
9357
|
-
};
|
|
9358
|
-
//#endregion
|
|
9359
|
-
//#region src/platform/kuaishou/KuaishouApi.ts
|
|
9360
|
-
/**
|
|
9361
|
-
* 创建废弃的 API 存根函数
|
|
9362
|
-
*/
|
|
9363
|
-
const createDeprecatedStub$1 = (methodName) => {
|
|
9364
|
-
return (..._args) => {
|
|
9365
|
-
checkDeprecation("getKuaishouData");
|
|
9366
|
-
throw new Error(`kuaishou.${methodName} 已废弃,请使用 kuaishouFetcher 替代`);
|
|
9367
|
-
};
|
|
9368
|
-
};
|
|
9369
|
-
/**
|
|
9370
|
-
* 快手相关 API 的命名空间。
|
|
9371
|
-
*
|
|
9372
|
-
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
9373
|
-
*/
|
|
9374
|
-
const kuaishou = {
|
|
9375
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchVideoWork 替代 */
|
|
9376
|
-
getWorkInfo: createDeprecatedStub$1("getWorkInfo"),
|
|
9377
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchWorkComments 替代 */
|
|
9378
|
-
getComments: createDeprecatedStub$1("getComments"),
|
|
9379
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchUserProfile 替代 */
|
|
9380
|
-
getUserProfile: createDeprecatedStub$1("getUserProfile"),
|
|
9381
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchUserWorkList 替代 */
|
|
9382
|
-
getUserWorkList: createDeprecatedStub$1("getUserWorkList"),
|
|
9383
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchLiveRoomInfo 替代 */
|
|
9384
|
-
getLiveRoomInfo: createDeprecatedStub$1("getLiveRoomInfo"),
|
|
9385
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchEmojiList 替代 */
|
|
9386
|
-
getEmojiList: createDeprecatedStub$1("getEmojiList")
|
|
9387
|
-
};
|
|
9388
|
-
/**
|
|
9389
|
-
* 创建绑定了cookie的快手API对象
|
|
9390
|
-
*
|
|
9391
|
-
* @deprecated v6 已废弃,请使用 createBoundKuaishouFetcher 替代
|
|
9392
|
-
*/
|
|
9393
|
-
const createBoundKuaishouApi = (_cookie, _requestConfig) => {
|
|
9394
|
-
return { ...kuaishou };
|
|
8687
|
+
douyinApiUrls
|
|
9395
8688
|
};
|
|
9396
8689
|
//#endregion
|
|
9397
8690
|
//#region src/platform/kuaishou/routes.ts
|
|
@@ -9445,48 +8738,7 @@ const createKuaishouRoutes = (cookie, requestConfig = getKuaishouDefaultConfig(c
|
|
|
9445
8738
|
/** 快手相关功能模块 (工具集) */
|
|
9446
8739
|
const kuaishouUtils = {
|
|
9447
8740
|
sign: kuaishouSign,
|
|
9448
|
-
kuaishouApiUrls
|
|
9449
|
-
api: kuaishou
|
|
9450
|
-
};
|
|
9451
|
-
//#endregion
|
|
9452
|
-
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9453
|
-
/**
|
|
9454
|
-
* 创建废弃的 API 存根函数
|
|
9455
|
-
*/
|
|
9456
|
-
const createDeprecatedStub = (methodName) => {
|
|
9457
|
-
return (..._args) => {
|
|
9458
|
-
checkDeprecation("getXiaohongshuData");
|
|
9459
|
-
throw new Error(`xiaohongshu.${methodName} 已废弃,请使用 xiaohongshuFetcher 替代`);
|
|
9460
|
-
};
|
|
9461
|
-
};
|
|
9462
|
-
/**
|
|
9463
|
-
* 封装了所有小红书相关的API请求,采用对象化的方式组织。
|
|
9464
|
-
*
|
|
9465
|
-
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9466
|
-
*/
|
|
9467
|
-
const xiaohongshu = {
|
|
9468
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchHomeFeed 替代 */
|
|
9469
|
-
getHomeFeed: createDeprecatedStub("getHomeFeed"),
|
|
9470
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteDetail 替代 */
|
|
9471
|
-
getNote: createDeprecatedStub("getNote"),
|
|
9472
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteComments 替代 */
|
|
9473
|
-
getComments: createDeprecatedStub("getComments"),
|
|
9474
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserProfile 替代 */
|
|
9475
|
-
getUser: createDeprecatedStub("getUser"),
|
|
9476
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserNoteList 替代 */
|
|
9477
|
-
getUserNotes: createDeprecatedStub("getUserNotes"),
|
|
9478
|
-
/** @deprecated 请使用 xiaohongshuFetcher.searchNotes 替代 */
|
|
9479
|
-
getSearchNotes: createDeprecatedStub("getSearchNotes"),
|
|
9480
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchEmojiList 替代 */
|
|
9481
|
-
getEmojiList: createDeprecatedStub("getEmojiList")
|
|
9482
|
-
};
|
|
9483
|
-
/**
|
|
9484
|
-
* 创建绑定了cookie的小红书API对象
|
|
9485
|
-
*
|
|
9486
|
-
* @deprecated v6 已废弃,请使用 createBoundXiaohongshuFetcher 替代
|
|
9487
|
-
*/
|
|
9488
|
-
const createBoundXiaohongshuApi = (_cookie, _requestConfig) => {
|
|
9489
|
-
return { ...xiaohongshu };
|
|
8741
|
+
kuaishouApiUrls
|
|
9490
8742
|
};
|
|
9491
8743
|
//#endregion
|
|
9492
8744
|
//#region src/platform/xiaohongshu/routes.ts
|
|
@@ -9540,8 +8792,7 @@ const createXiaohongshuRoutes = (cookie, requestConfig = getXiaohongshuDefaultCo
|
|
|
9540
8792
|
/** 小红书相关功能模块 (工具集) */
|
|
9541
8793
|
const xiaohongshuUtils = {
|
|
9542
8794
|
sign: xiaohongshuSign,
|
|
9543
|
-
xiaohongshuApiUrls
|
|
9544
|
-
api: xiaohongshu
|
|
8795
|
+
xiaohongshuApiUrls
|
|
9545
8796
|
};
|
|
9546
8797
|
//#endregion
|
|
9547
8798
|
//#region src/server/index.ts
|
|
@@ -9588,38 +8839,6 @@ const createAmagiClient = (options) => {
|
|
|
9588
8839
|
});
|
|
9589
8840
|
return app;
|
|
9590
8841
|
};
|
|
9591
|
-
/**
|
|
9592
|
-
* @deprecated v6 已废弃,请使用 douyin.fetcher 替代
|
|
9593
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9594
|
-
*/
|
|
9595
|
-
const getDouyinData = (..._args) => {
|
|
9596
|
-
checkDeprecation("getDouyinData");
|
|
9597
|
-
throw new Error("getDouyinData 已废弃");
|
|
9598
|
-
};
|
|
9599
|
-
/**
|
|
9600
|
-
* @deprecated v6 已废弃,请使用 bilibili.fetcher 替代
|
|
9601
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9602
|
-
*/
|
|
9603
|
-
const getBilibiliData = (..._args) => {
|
|
9604
|
-
checkDeprecation("getBilibiliData");
|
|
9605
|
-
throw new Error("getBilibiliData 已废弃");
|
|
9606
|
-
};
|
|
9607
|
-
/**
|
|
9608
|
-
* @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代
|
|
9609
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9610
|
-
*/
|
|
9611
|
-
const getKuaishouData = (..._args) => {
|
|
9612
|
-
checkDeprecation("getKuaishouData");
|
|
9613
|
-
throw new Error("getKuaishouData 已废弃");
|
|
9614
|
-
};
|
|
9615
|
-
/**
|
|
9616
|
-
* @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代
|
|
9617
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9618
|
-
*/
|
|
9619
|
-
const getXiaohongshuData = (..._args) => {
|
|
9620
|
-
checkDeprecation("getXiaohongshuData");
|
|
9621
|
-
throw new Error("getXiaohongshuData 已废弃");
|
|
9622
|
-
};
|
|
9623
8842
|
return {
|
|
9624
8843
|
/** 启动本地HTTP服务 */
|
|
9625
8844
|
startServer,
|
|
@@ -9637,39 +8856,23 @@ const createAmagiClient = (options) => {
|
|
|
9637
8856
|
* @param listener - 事件处理函数 (只触发一次)
|
|
9638
8857
|
*/
|
|
9639
8858
|
once: (event, listener) => amagiEvents.once(event, listener),
|
|
9640
|
-
/** @deprecated v6 已废弃,请使用 douyin.fetcher 替代 */
|
|
9641
|
-
getDouyinData,
|
|
9642
|
-
/** @deprecated v6 已废弃,请使用 bilibili.fetcher 替代 */
|
|
9643
|
-
getBilibiliData,
|
|
9644
|
-
/** @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代 */
|
|
9645
|
-
getKuaishouData,
|
|
9646
|
-
/** @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代 */
|
|
9647
|
-
getXiaohongshuData,
|
|
9648
8859
|
douyin: {
|
|
9649
8860
|
...douyinUtils,
|
|
9650
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9651
|
-
api: createBoundDouyinApi(douyinCookie, requestConfig),
|
|
9652
8861
|
/** fetcher */
|
|
9653
8862
|
fetcher: createBoundDouyinFetcher(douyinCookie, requestConfig)
|
|
9654
8863
|
},
|
|
9655
8864
|
bilibili: {
|
|
9656
8865
|
...bilibiliUtils,
|
|
9657
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9658
|
-
api: createBoundBilibiliApi(bilibiliCookie, requestConfig),
|
|
9659
8866
|
/** fetcher */
|
|
9660
8867
|
fetcher: createBoundBilibiliFetcher(bilibiliCookie, requestConfig)
|
|
9661
8868
|
},
|
|
9662
8869
|
kuaishou: {
|
|
9663
8870
|
...kuaishouUtils,
|
|
9664
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9665
|
-
api: createBoundKuaishouApi(kuaishouCookie, requestConfig),
|
|
9666
8871
|
/** fetcher */
|
|
9667
8872
|
fetcher: createBoundKuaishouFetcher(kuaishouCookie, requestConfig)
|
|
9668
8873
|
},
|
|
9669
8874
|
xiaohongshu: {
|
|
9670
8875
|
...xiaohongshuUtils,
|
|
9671
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9672
|
-
api: createBoundXiaohongshuApi(xiaohongshuCookie, requestConfig),
|
|
9673
8876
|
/** fetcher */
|
|
9674
8877
|
fetcher: createBoundXiaohongshuFetcher(xiaohongshuCookie, requestConfig)
|
|
9675
8878
|
}
|
|
@@ -9833,7 +9036,6 @@ const BilibiliInternalMethods = {
|
|
|
9833
9036
|
USER_SPACE_INFO: "用户空间详细信息",
|
|
9834
9037
|
USER_TOTAL_VIEWS: "获取UP主总播放量",
|
|
9835
9038
|
DYNAMIC_DETAIL: "动态详情数据",
|
|
9836
|
-
DYNAMIC_CARD: "动态卡片数据",
|
|
9837
9039
|
BANGUMI_INFO: "番剧基本信息数据",
|
|
9838
9040
|
BANGUMI_STREAM: "番剧下载信息数据",
|
|
9839
9041
|
LIVE_ROOM_INFO: "直播间信息",
|
|
@@ -9864,7 +9066,6 @@ const BilibiliFetcherMethods = {
|
|
|
9864
9066
|
USER_SPACE_INFO: "fetchUserSpaceInfo",
|
|
9865
9067
|
USER_TOTAL_VIEWS: "fetchUploaderTotalViews",
|
|
9866
9068
|
DYNAMIC_DETAIL: "fetchDynamicDetail",
|
|
9867
|
-
DYNAMIC_CARD: "fetchDynamicCard",
|
|
9868
9069
|
BANGUMI_INFO: "fetchBangumiInfo",
|
|
9869
9070
|
BANGUMI_STREAM: "fetchBangumiStreamUrl",
|
|
9870
9071
|
LIVE_ROOM_INFO: "fetchLiveRoomInfo",
|
|
@@ -9973,7 +9174,6 @@ const BilibiliMethodToFetcher = {
|
|
|
9973
9174
|
[BilibiliInternalMethods.USER_SPACE_INFO]: BilibiliFetcherMethods.USER_SPACE_INFO,
|
|
9974
9175
|
[BilibiliInternalMethods.USER_TOTAL_VIEWS]: BilibiliFetcherMethods.USER_TOTAL_VIEWS,
|
|
9975
9176
|
[BilibiliInternalMethods.DYNAMIC_DETAIL]: BilibiliFetcherMethods.DYNAMIC_DETAIL,
|
|
9976
|
-
[BilibiliInternalMethods.DYNAMIC_CARD]: BilibiliFetcherMethods.DYNAMIC_CARD,
|
|
9977
9177
|
[BilibiliInternalMethods.BANGUMI_INFO]: BilibiliFetcherMethods.BANGUMI_INFO,
|
|
9978
9178
|
[BilibiliInternalMethods.BANGUMI_STREAM]: BilibiliFetcherMethods.BANGUMI_STREAM,
|
|
9979
9179
|
[BilibiliInternalMethods.LIVE_ROOM_INFO]: BilibiliFetcherMethods.LIVE_ROOM_INFO,
|
|
@@ -10105,7 +9305,6 @@ const BilibiliMethodMapping = {
|
|
|
10105
9305
|
用户空间详细信息: "fetchUserSpaceInfo",
|
|
10106
9306
|
获取UP主总播放量: "fetchUploaderTotalViews",
|
|
10107
9307
|
动态详情数据: "fetchDynamicDetail",
|
|
10108
|
-
动态卡片数据: "fetchDynamicCard",
|
|
10109
9308
|
番剧基本信息数据: "fetchBangumiInfo",
|
|
10110
9309
|
番剧下载信息数据: "fetchBangumiStreamUrl",
|
|
10111
9310
|
直播间信息: "fetchLiveRoomInfo",
|
|
@@ -10188,7 +9387,6 @@ const BilibiliApiRoutes = {
|
|
|
10188
9387
|
userSpaceInfo: "/user/space",
|
|
10189
9388
|
uploaderTotalViews: "/user/total-views",
|
|
10190
9389
|
dynamicDetail: "/dynamic",
|
|
10191
|
-
dynamicCard: "/dynamic/card",
|
|
10192
9390
|
bangumiInfo: "/bangumi",
|
|
10193
9391
|
bangumiStream: "/bangumi/stream",
|
|
10194
9392
|
liveRoomInfo: "/live",
|
|
@@ -10258,14 +9456,10 @@ function getApiRoute(platform, methodType) {
|
|
|
10258
9456
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
10259
9457
|
*/
|
|
10260
9458
|
const getVersion = () => {
|
|
10261
|
-
return "6.
|
|
9459
|
+
return "6.5.0";
|
|
10262
9460
|
};
|
|
10263
9461
|
const VERSION = getVersion();
|
|
10264
9462
|
/**
|
|
10265
|
-
* @deprecated 请使用 createAmagiClient 替代
|
|
10266
|
-
*/
|
|
10267
|
-
const amagiClient = createAmagiClient;
|
|
10268
|
-
/**
|
|
10269
9463
|
* 创建一个新的 amagi 客户端实例
|
|
10270
9464
|
* 用于创建和初始化一个新的 amagi 客户端实例,支持通过 new 关键字或函数调用方式使用
|
|
10271
9465
|
* @param options - cookies 配置选项,用于设置客户端的 cookies 相关参数
|
|
@@ -10285,10 +9479,6 @@ CreateAmagiApp.douyin = douyinUtils;
|
|
|
10285
9479
|
CreateAmagiApp.bilibili = bilibiliUtils;
|
|
10286
9480
|
CreateAmagiApp.kuaishou = kuaishouUtils;
|
|
10287
9481
|
CreateAmagiApp.xiaohongshu = xiaohongshuUtils;
|
|
10288
|
-
CreateAmagiApp.getDouyinData = getDouyinData;
|
|
10289
|
-
CreateAmagiApp.getBilibiliData = getBilibiliData;
|
|
10290
|
-
CreateAmagiApp.getKuaishouData = getKuaishouData;
|
|
10291
|
-
CreateAmagiApp.getXiaohongshuData = getXiaohongshuData;
|
|
10292
9482
|
CreateAmagiApp.events = amagiEvents;
|
|
10293
9483
|
CreateAmagiApp.on = amagiEvents.on.bind(amagiEvents);
|
|
10294
9484
|
CreateAmagiApp.once = amagiEvents.once.bind(amagiEvents);
|
|
@@ -10389,10 +9579,8 @@ exports.XiaohongshuMethodRoutes = XiaohongshuMethodRoutes;
|
|
|
10389
9579
|
exports.XiaohongshuMethodToFetcher = XiaohongshuMethodToFetcher;
|
|
10390
9580
|
exports.XiaohongshuValidationSchemas = XiaohongshuValidationSchemas;
|
|
10391
9581
|
exports.amagi = amagi;
|
|
10392
|
-
exports.amagiClient = amagiClient;
|
|
10393
9582
|
exports.amagiEvents = amagiEvents;
|
|
10394
9583
|
exports.av2bv = av2bv;
|
|
10395
|
-
exports.bilibili = bilibili;
|
|
10396
9584
|
exports.bilibiliApiUrls = bilibiliApiUrls;
|
|
10397
9585
|
exports.bilibiliErrorCodeMap = bilibiliErrorCodeMap;
|
|
10398
9586
|
exports.bilibiliFetcher = bilibiliFetcher;
|
|
@@ -10400,13 +9588,9 @@ exports.bilibiliUtils = bilibiliUtils;
|
|
|
10400
9588
|
exports.bv2av = bv2av;
|
|
10401
9589
|
exports.createAmagiClient = createAmagiClient;
|
|
10402
9590
|
exports.createBilibiliRoutes = createBilibiliRoutes;
|
|
10403
|
-
exports.createBoundBilibiliApi = createBoundBilibiliApi;
|
|
10404
9591
|
exports.createBoundBilibiliFetcher = createBoundBilibiliFetcher;
|
|
10405
|
-
exports.createBoundDouyinApi = createBoundDouyinApi;
|
|
10406
9592
|
exports.createBoundDouyinFetcher = createBoundDouyinFetcher;
|
|
10407
|
-
exports.createBoundKuaishouApi = createBoundKuaishouApi;
|
|
10408
9593
|
exports.createBoundKuaishouFetcher = createBoundKuaishouFetcher;
|
|
10409
|
-
exports.createBoundXiaohongshuApi = createBoundXiaohongshuApi;
|
|
10410
9594
|
exports.createBoundXiaohongshuFetcher = createBoundXiaohongshuFetcher;
|
|
10411
9595
|
exports.createDouyinRoutes = createDouyinRoutes;
|
|
10412
9596
|
exports.createErrorResponse = createErrorResponse;
|
|
@@ -10414,7 +9598,6 @@ exports.createKuaishouRoutes = createKuaishouRoutes;
|
|
|
10414
9598
|
exports.createSuccessResponse = createSuccessResponse;
|
|
10415
9599
|
exports.createXiaohongshuRoutes = createXiaohongshuRoutes;
|
|
10416
9600
|
exports.default = Client;
|
|
10417
|
-
exports.douyin = douyin;
|
|
10418
9601
|
exports.douyinApiUrls = douyinApiUrls;
|
|
10419
9602
|
exports.douyinFetcher = douyinFetcher;
|
|
10420
9603
|
exports.douyinSign = douyinSign;
|
|
@@ -10434,22 +9617,14 @@ exports.emitNetworkRetry = emitNetworkRetry;
|
|
|
10434
9617
|
exports.fetchData = fetchData;
|
|
10435
9618
|
exports.fetchResponse = fetchResponse;
|
|
10436
9619
|
exports.getApiRoute = getApiRoute;
|
|
10437
|
-
exports.getBilibiliData = getBilibiliData;
|
|
10438
|
-
exports.getDouyinData = getDouyinData;
|
|
10439
9620
|
exports.getEnglishMethodName = getEnglishMethodName;
|
|
10440
9621
|
exports.getHeadersAndData = getHeadersAndData;
|
|
10441
|
-
exports.getKuaishouData = getKuaishouData;
|
|
10442
9622
|
exports.handleError = handleError;
|
|
10443
|
-
exports.httpLogger = httpLogger;
|
|
10444
|
-
exports.initLogger = initLogger;
|
|
10445
9623
|
exports.isNetworkErrorResult = isNetworkErrorResult;
|
|
10446
|
-
exports.kuaishou = kuaishou;
|
|
10447
9624
|
exports.kuaishouApiUrls = kuaishouApiUrls;
|
|
10448
9625
|
exports.kuaishouFetcher = kuaishouFetcher;
|
|
10449
9626
|
exports.kuaishouSign = kuaishouSign;
|
|
10450
9627
|
exports.kuaishouUtils = kuaishouUtils;
|
|
10451
|
-
exports.logMiddleware = logMiddleware;
|
|
10452
|
-
exports.logger = logger;
|
|
10453
9628
|
exports.parseDmSegMobileReply = parseDmSegMobileReply;
|
|
10454
9629
|
exports.qtparam = qtparam;
|
|
10455
9630
|
exports.registerBilibiliRoutes = createBilibiliRoutes;
|
|
@@ -10462,7 +9637,6 @@ exports.validateDouyinParams = validateDouyinParams;
|
|
|
10462
9637
|
exports.validateKuaishouParams = validateKuaishouParams;
|
|
10463
9638
|
exports.validateXiaohongshuParams = validateXiaohongshuParams;
|
|
10464
9639
|
exports.wbi_sign = wbi_sign;
|
|
10465
|
-
exports.xiaohongshu = xiaohongshu;
|
|
10466
9640
|
exports.xiaohongshuApiUrls = xiaohongshuApiUrls;
|
|
10467
9641
|
exports.xiaohongshuFetcher = xiaohongshuFetcher;
|
|
10468
9642
|
exports.xiaohongshuSign = xiaohongshuSign;
|