@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.mjs
CHANGED
|
@@ -4,448 +4,9 @@ import zod from "zod";
|
|
|
4
4
|
import { CryptoConfig, FingerprintGenerator, Xhshow } from "@ikenxuan/xhshow-ts";
|
|
5
5
|
import crypto, { createCipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import axios, { AxiosError } from "axios";
|
|
7
|
-
import { Chalk } from "chalk";
|
|
8
7
|
import protobuf from "protobufjs";
|
|
9
8
|
import express from "express";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 废弃 API 注册表
|
|
13
|
-
* 存储所有已注册的废弃 API 配置
|
|
14
|
-
*/
|
|
15
|
-
const deprecatedApis = /* @__PURE__ */ new Map();
|
|
16
|
-
/**
|
|
17
|
-
* 注册一个废弃的 API
|
|
18
|
-
*
|
|
19
|
-
* 将 API 添加到废弃注册表中,后续可通过 checkDeprecation 检查
|
|
20
|
-
*
|
|
21
|
-
* @param config - 废弃配置对象
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* registerDeprecatedApi({
|
|
26
|
-
* name: 'getDouyinData',
|
|
27
|
-
* deprecatedIn: '6.0.0',
|
|
28
|
-
* removedIn: '7.0.0',
|
|
29
|
-
* replacement: 'douyinFetcher',
|
|
30
|
-
* throwError: true
|
|
31
|
-
* })
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
function registerDeprecatedApi(config) {
|
|
35
|
-
deprecatedApis.set(config.name, config);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* 检查 API 是否已废弃并进行相应处理
|
|
39
|
-
*
|
|
40
|
-
* 如果 API 已注册为废弃,根据配置决定是打印警告还是抛出错误
|
|
41
|
-
*
|
|
42
|
-
* @param apiName - 要检查的 API 名称
|
|
43
|
-
* @throws {DeprecatedApiError} 如果 API 已废弃且配置为抛出错误
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* // 在函数开头调用检查
|
|
48
|
-
* function getDouyinData(options) {
|
|
49
|
-
* checkDeprecation('getDouyinData')
|
|
50
|
-
* // ...
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
function checkDeprecation(apiName) {
|
|
55
|
-
const config = deprecatedApis.get(apiName);
|
|
56
|
-
if (!config) return;
|
|
57
|
-
const message = buildDeprecationMessage(config);
|
|
58
|
-
if (config.throwError) throw new DeprecatedApiError(message, config);
|
|
59
|
-
else console.warn(message);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 根据配置构建废弃提示消息
|
|
63
|
-
*
|
|
64
|
-
* @param config - 废弃配置
|
|
65
|
-
* @returns 格式化的废弃提示消息字符串
|
|
66
|
-
*/
|
|
67
|
-
function buildDeprecationMessage(config) {
|
|
68
|
-
const lines = [`[DEPRECATED] "${config.name}" 已在 v${config.deprecatedIn} 版本废弃。`];
|
|
69
|
-
if (config.replacement) lines.push(`请使用 "${config.replacement}" 替代。`);
|
|
70
|
-
else lines.push("此接口已被上游删除,无法继续使用,无可用替代方案。");
|
|
71
|
-
if (config.removedIn) lines.push(`此 API 将在 v${config.removedIn} 版本移除。`);
|
|
72
|
-
if (config.migrationGuide) lines.push(`迁移指南: ${config.migrationGuide}`);
|
|
73
|
-
return lines.join("\n");
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 废弃 API 调用错误类
|
|
77
|
-
*
|
|
78
|
-
* 当调用已废弃且配置为抛出错误的 API 时抛出此错误
|
|
79
|
-
* 包含完整的废弃配置信息,便于调试和迁移
|
|
80
|
-
*/
|
|
81
|
-
var DeprecatedApiError = class DeprecatedApiError extends Error {
|
|
82
|
-
/** 废弃配置信息,包含替代方案等详细信息 */
|
|
83
|
-
config;
|
|
84
|
-
/**
|
|
85
|
-
* 创建废弃 API 错误实例
|
|
86
|
-
*
|
|
87
|
-
* @param message - 错误消息
|
|
88
|
-
* @param config - 废弃配置对象
|
|
89
|
-
*/
|
|
90
|
-
constructor(message, config) {
|
|
91
|
-
super(message);
|
|
92
|
-
this.name = "DeprecatedApiError";
|
|
93
|
-
this.config = config;
|
|
94
|
-
Error.captureStackTrace?.(this, DeprecatedApiError);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
registerDeprecatedApi({
|
|
98
|
-
name: "getDouyinData",
|
|
99
|
-
deprecatedIn: "6.0.0",
|
|
100
|
-
removedIn: "7.0.0",
|
|
101
|
-
replacement: "douyinFetcher 或 client.douyin.fetcher",
|
|
102
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
103
|
-
throwError: true
|
|
104
|
-
});
|
|
105
|
-
registerDeprecatedApi({
|
|
106
|
-
name: "getBilibiliData",
|
|
107
|
-
deprecatedIn: "6.0.0",
|
|
108
|
-
removedIn: "7.0.0",
|
|
109
|
-
replacement: "bilibiliFetcher 或 client.bilibili.fetcher",
|
|
110
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
111
|
-
throwError: true
|
|
112
|
-
});
|
|
113
|
-
registerDeprecatedApi({
|
|
114
|
-
name: "getKuaishouData",
|
|
115
|
-
deprecatedIn: "6.0.0",
|
|
116
|
-
removedIn: "7.0.0",
|
|
117
|
-
replacement: "kuaishouFetcher 或 client.kuaishou.fetcher",
|
|
118
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
119
|
-
throwError: true
|
|
120
|
-
});
|
|
121
|
-
registerDeprecatedApi({
|
|
122
|
-
name: "getXiaohongshuData",
|
|
123
|
-
deprecatedIn: "6.0.0",
|
|
124
|
-
removedIn: "7.0.0",
|
|
125
|
-
replacement: "xiaohongshuFetcher 或 client.xiaohongshu.fetcher",
|
|
126
|
-
migrationGuide: "https://github.com/ikenxuan/amagi/blob/main/packages/core/MIGRATION-v6.md",
|
|
127
|
-
throwError: true
|
|
128
|
-
});
|
|
129
|
-
[
|
|
130
|
-
{
|
|
131
|
-
name: "单个视频作品数据",
|
|
132
|
-
replacement: "fetchVideoInfo"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: "单个视频下载信息数据",
|
|
136
|
-
replacement: "fetchVideoStreamUrl"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "评论数据",
|
|
140
|
-
replacement: "fetchComments"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "指定评论的回复",
|
|
144
|
-
replacement: "fetchCommentReplies"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "用户主页数据",
|
|
148
|
-
replacement: "fetchUserCard"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: "用户主页动态列表数据",
|
|
152
|
-
replacement: "fetchUserDynamicList"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
name: "用户空间详细信息",
|
|
156
|
-
replacement: "fetchUserSpaceInfo"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: "获取UP主总播放量",
|
|
160
|
-
replacement: "fetchUploaderTotalViews"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: "Emoji数据",
|
|
164
|
-
replacement: "fetchEmojiList"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "番剧基本信息数据",
|
|
168
|
-
replacement: "fetchBangumiInfo"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "番剧下载信息数据",
|
|
172
|
-
replacement: "fetchBangumiStreamUrl"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "动态详情数据",
|
|
176
|
-
replacement: "fetchDynamicDetail"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: "直播间信息",
|
|
180
|
-
replacement: "fetchLiveRoomInfo"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "直播间初始化信息",
|
|
184
|
-
replacement: "fetchLiveRoomInitInfo"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: "登录基本信息",
|
|
188
|
-
replacement: "fetchLoginStatus"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "申请二维码",
|
|
192
|
-
replacement: "requestLoginQrcode"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: "二维码状态",
|
|
196
|
-
replacement: "checkQrcodeStatus"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
name: "AV转BV",
|
|
200
|
-
replacement: "convertAvToBv"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
name: "BV转AV",
|
|
204
|
-
replacement: "convertBvToAv"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: "专栏正文内容",
|
|
208
|
-
replacement: "fetchArticleContent"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: "专栏显示卡片信息",
|
|
212
|
-
replacement: "fetchArticleCards"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: "专栏文章基本信息",
|
|
216
|
-
replacement: "fetchArticleInfo"
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: "文集基本信息",
|
|
220
|
-
replacement: "fetchArticleListInfo"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: "实时弹幕",
|
|
224
|
-
replacement: "fetchVideoDanmaku"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
name: "从_v_voucher_申请_captcha",
|
|
228
|
-
replacement: "requestCaptchaFromVoucher"
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: "验证验证码结果",
|
|
232
|
-
replacement: "validateCaptchaResult"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "视频作品数据",
|
|
236
|
-
replacement: "fetchVideoWork"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: "图集作品数据",
|
|
240
|
-
replacement: "fetchImageAlbumWork"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: "合辑作品数据",
|
|
244
|
-
replacement: "fetchSlidesWork"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "文字作品数据",
|
|
248
|
-
replacement: "fetchTextWork"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: "聚合解析",
|
|
252
|
-
replacement: "parseWork"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: "指定评论回复数据",
|
|
256
|
-
replacement: "fetchCommentReplies"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: "用户主页视频列表数据",
|
|
260
|
-
replacement: "fetchUserVideoList"
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "热点词数据",
|
|
264
|
-
replacement: "fetchSuggestWords"
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: "搜索数据",
|
|
268
|
-
replacement: "searchContent"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: "音乐数据",
|
|
272
|
-
replacement: "fetchMusicInfo"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: "直播间信息数据",
|
|
276
|
-
replacement: "fetchLiveRoomInfo"
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: "申请二维码数据",
|
|
280
|
-
replacement: "requestLoginQrcode"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: "动态表情数据",
|
|
284
|
-
replacement: "fetchDynamicEmojiList"
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: "弹幕数据",
|
|
288
|
-
replacement: "fetchDanmakuList"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
name: "单个视频作品数据",
|
|
292
|
-
replacement: "fetchVideoWork"
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: "首页推荐数据",
|
|
296
|
-
replacement: "fetchHomeFeed"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
name: "单个笔记数据",
|
|
300
|
-
replacement: "fetchNoteDetail"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
name: "用户数据",
|
|
304
|
-
replacement: "fetchUserProfile"
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
name: "用户笔记数据",
|
|
308
|
-
replacement: "fetchUserNoteList"
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
name: "表情列表",
|
|
312
|
-
replacement: "fetchEmojiList"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
name: "搜索笔记",
|
|
316
|
-
replacement: "searchNotes"
|
|
317
|
-
}
|
|
318
|
-
].forEach(({ name, replacement }) => {
|
|
319
|
-
registerDeprecatedApi({
|
|
320
|
-
name: `methodType: '${name}'`,
|
|
321
|
-
deprecatedIn: "6.0.0",
|
|
322
|
-
removedIn: "7.0.0",
|
|
323
|
-
replacement: `fetcher.${replacement}()`,
|
|
324
|
-
throwError: true
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
registerDeprecatedApi({
|
|
328
|
-
name: `methodType: '动态卡片数据'`,
|
|
329
|
-
deprecatedIn: "6.0.0",
|
|
330
|
-
removedIn: "7.0.0",
|
|
331
|
-
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
332
|
-
throwError: false
|
|
333
|
-
});
|
|
334
|
-
registerDeprecatedApi({
|
|
335
|
-
name: "fetchDynamicCard",
|
|
336
|
-
deprecatedIn: "6.1.3",
|
|
337
|
-
removedIn: "7.0.0",
|
|
338
|
-
migrationGuide: "https://amagi-docs.vercel.app/docs/changelog/6.1.3",
|
|
339
|
-
throwError: false
|
|
340
|
-
});
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region src/model/DataFetchers.ts
|
|
343
|
-
/**
|
|
344
|
-
* 数据获取器模块 (已废弃)
|
|
345
|
-
*
|
|
346
|
-
* 此模块中的 getXXXData 函数已在 v6 版本废弃并移除
|
|
347
|
-
* 请使用新的 fetcher API 替代
|
|
348
|
-
*
|
|
349
|
-
* @module model/DataFetchers
|
|
350
|
-
* @deprecated v6 已废弃,请使用 fetcher API 替代
|
|
351
|
-
*/
|
|
352
|
-
/**
|
|
353
|
-
* 获取抖音数据
|
|
354
|
-
*
|
|
355
|
-
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
356
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* ```typescript
|
|
360
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
361
|
-
* const data = await getDouyinData('videoWork', { aweme_id: '123' }, cookie)
|
|
362
|
-
*
|
|
363
|
-
* // 新用法
|
|
364
|
-
* import { douyinFetcher } from '@ikenxuan/amagi'
|
|
365
|
-
* const data = await douyinFetcher.fetchVideoWork({ aweme_id: '123' }, cookie)
|
|
366
|
-
*
|
|
367
|
-
* // 或使用客户端实例
|
|
368
|
-
* const client = createAmagiClient({ cookies: { douyin: cookie } })
|
|
369
|
-
* const data = await client.douyin.fetcher.fetchVideoWork({ aweme_id: '123' })
|
|
370
|
-
* ```
|
|
371
|
-
*/
|
|
372
|
-
function getDouyinData(..._args) {
|
|
373
|
-
checkDeprecation("getDouyinData");
|
|
374
|
-
throw new Error("getDouyinData 已废弃");
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* 获取B站数据
|
|
378
|
-
*
|
|
379
|
-
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
380
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```typescript
|
|
384
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
385
|
-
* const data = await getBilibiliData('videoInfo', { bvid: 'BV123' }, cookie)
|
|
386
|
-
*
|
|
387
|
-
* // 新用法
|
|
388
|
-
* import { bilibiliFetcher } from '@ikenxuan/amagi'
|
|
389
|
-
* const data = await bilibiliFetcher.fetchVideoInfo({ bvid: 'BV123' }, cookie)
|
|
390
|
-
*
|
|
391
|
-
* // 或使用客户端实例
|
|
392
|
-
* const client = createAmagiClient({ cookies: { bilibili: cookie } })
|
|
393
|
-
* const data = await client.bilibili.fetcher.fetchVideoInfo({ bvid: 'BV123' })
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
function getBilibiliData(..._args) {
|
|
397
|
-
checkDeprecation("getBilibiliData");
|
|
398
|
-
throw new Error("getBilibiliData 已废弃");
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* 获取快手数据
|
|
402
|
-
*
|
|
403
|
-
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
404
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
405
|
-
*
|
|
406
|
-
* @example
|
|
407
|
-
* ```typescript
|
|
408
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
409
|
-
* const data = await getKuaishouData('videoWork', { photoId: '123' }, cookie)
|
|
410
|
-
*
|
|
411
|
-
* // 新用法
|
|
412
|
-
* import { kuaishouFetcher } from '@ikenxuan/amagi'
|
|
413
|
-
* const data = await kuaishouFetcher.fetchVideoWork({ photoId: '123' }, cookie)
|
|
414
|
-
*
|
|
415
|
-
* // 或使用客户端实例
|
|
416
|
-
* const client = createAmagiClient({ cookies: { kuaishou: cookie } })
|
|
417
|
-
* const data = await client.kuaishou.fetcher.fetchVideoWork({ photoId: '123' })
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
function getKuaishouData(..._args) {
|
|
421
|
-
checkDeprecation("getKuaishouData");
|
|
422
|
-
throw new Error("getKuaishouData 已废弃");
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* 获取小红书数据
|
|
426
|
-
*
|
|
427
|
-
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
428
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
429
|
-
*
|
|
430
|
-
* @example
|
|
431
|
-
* ```typescript
|
|
432
|
-
* // 旧用法 (已废弃,会抛出错误)
|
|
433
|
-
* const data = await getXiaohongshuData('noteDetail', { note_id: '123' }, cookie)
|
|
434
|
-
*
|
|
435
|
-
* // 新用法
|
|
436
|
-
* import { xiaohongshuFetcher } from '@ikenxuan/amagi'
|
|
437
|
-
* const data = await xiaohongshuFetcher.fetchNoteDetail({ note_id: '123' }, cookie)
|
|
438
|
-
*
|
|
439
|
-
* // 或使用客户端实例
|
|
440
|
-
* const client = createAmagiClient({ cookies: { xiaohongshu: cookie } })
|
|
441
|
-
* const data = await client.xiaohongshu.fetcher.fetchNoteDetail({ note_id: '123' })
|
|
442
|
-
* ```
|
|
443
|
-
*/
|
|
444
|
-
function getXiaohongshuData(..._args) {
|
|
445
|
-
checkDeprecation("getXiaohongshuData");
|
|
446
|
-
throw new Error("getXiaohongshuData 已废弃");
|
|
447
|
-
}
|
|
448
|
-
//#endregion
|
|
9
|
+
import { Chalk } from "chalk";
|
|
449
10
|
//#region src/platform/bilibili/API.ts
|
|
450
11
|
/**
|
|
451
12
|
* B站 API URL 构建类
|
|
@@ -517,15 +78,6 @@ var BilibiliAPI = class {
|
|
|
517
78
|
getDynamicDetail(data) {
|
|
518
79
|
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`;
|
|
519
80
|
}
|
|
520
|
-
/**
|
|
521
|
-
* 获取动态卡片信息
|
|
522
|
-
*
|
|
523
|
-
* @deprecated B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口,该接口已停用。
|
|
524
|
-
* 调用将返回错误信息,请使用 {@link getDynamicDetail} 替代。
|
|
525
|
-
*/
|
|
526
|
-
getDynamicCard(data) {
|
|
527
|
-
return this.getDynamicDetail(data);
|
|
528
|
-
}
|
|
529
81
|
/** 获取用户名片信息 */
|
|
530
82
|
getUserCard(data) {
|
|
531
83
|
return `https://api.bilibili.com/x/web-interface/card?mid=${data.host_mid}&photo=true`;
|
|
@@ -617,86 +169,6 @@ var BilibiliAPI = class {
|
|
|
617
169
|
/** B站 API URL 构建器实例 */
|
|
618
170
|
const bilibiliApiUrls = new BilibiliAPI();
|
|
619
171
|
//#endregion
|
|
620
|
-
//#region src/platform/bilibili/BilibiliApi.ts
|
|
621
|
-
/**
|
|
622
|
-
* 创建废弃的 API 存根函数
|
|
623
|
-
*/
|
|
624
|
-
const createDeprecatedStub$3 = (methodName) => {
|
|
625
|
-
return (..._args) => {
|
|
626
|
-
checkDeprecation("getBilibiliData");
|
|
627
|
-
throw new Error(`bilibili.${methodName} 已废弃,请使用 bilibiliFetcher 替代`);
|
|
628
|
-
};
|
|
629
|
-
};
|
|
630
|
-
/**
|
|
631
|
-
* B站相关 API 的命名空间。
|
|
632
|
-
*
|
|
633
|
-
* @deprecated v6 已废弃,请使用 bilibiliFetcher 或 client.bilibili.fetcher 替代
|
|
634
|
-
*/
|
|
635
|
-
const bilibili = {
|
|
636
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoInfo 替代 */
|
|
637
|
-
getVideoInfo: createDeprecatedStub$3("getVideoInfo"),
|
|
638
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoStreamUrl 替代 */
|
|
639
|
-
getVideoStream: createDeprecatedStub$3("getVideoStream"),
|
|
640
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchComments 替代 */
|
|
641
|
-
getComments: createDeprecatedStub$3("getComments"),
|
|
642
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchCommentReplies 替代 */
|
|
643
|
-
getCommentReply: createDeprecatedStub$3("getCommentReply"),
|
|
644
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserCard 替代 */
|
|
645
|
-
getUserProfile: createDeprecatedStub$3("getUserProfile"),
|
|
646
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserDynamicList 替代 */
|
|
647
|
-
getUserDynamic: createDeprecatedStub$3("getUserDynamic"),
|
|
648
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchEmojiList 替代 */
|
|
649
|
-
getEmojiList: createDeprecatedStub$3("getEmojiList"),
|
|
650
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiInfo 替代 */
|
|
651
|
-
getBangumiInfo: createDeprecatedStub$3("getBangumiInfo"),
|
|
652
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchBangumiStreamUrl 替代 */
|
|
653
|
-
getBangumiStream: createDeprecatedStub$3("getBangumiStream"),
|
|
654
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicDetail 替代 */
|
|
655
|
-
getDynamicInfo: createDeprecatedStub$3("getDynamicInfo"),
|
|
656
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchDynamicCard 替代 */
|
|
657
|
-
getDynamicCard: createDeprecatedStub$3("getDynamicCard"),
|
|
658
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInfo 替代 */
|
|
659
|
-
getLiveRoomDetail: createDeprecatedStub$3("getLiveRoomDetail"),
|
|
660
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLiveRoomInitInfo 替代 */
|
|
661
|
-
getLiveRoomInitInfo: createDeprecatedStub$3("getLiveRoomInitInfo"),
|
|
662
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchLoginStatus 替代 */
|
|
663
|
-
getLoginBasicInfo: createDeprecatedStub$3("getLoginBasicInfo"),
|
|
664
|
-
/** @deprecated 请使用 bilibiliFetcher.requestLoginQrcode 替代 */
|
|
665
|
-
getLoginQrcode: createDeprecatedStub$3("getLoginQrcode"),
|
|
666
|
-
/** @deprecated 请使用 bilibiliFetcher.checkQrcodeStatus 替代 */
|
|
667
|
-
checkQrcodeStatus: createDeprecatedStub$3("checkQrcodeStatus"),
|
|
668
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUploaderTotalViews 替代 */
|
|
669
|
-
getUserTotalPlayCount: createDeprecatedStub$3("getUserTotalPlayCount"),
|
|
670
|
-
/** @deprecated 请使用 bilibiliFetcher.convertAvToBv 替代 */
|
|
671
|
-
convertAvToBv: createDeprecatedStub$3("convertAvToBv"),
|
|
672
|
-
/** @deprecated 请使用 bilibiliFetcher.convertBvToAv 替代 */
|
|
673
|
-
convertBvToAv: createDeprecatedStub$3("convertBvToAv"),
|
|
674
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleContent 替代 */
|
|
675
|
-
getArticleContent: createDeprecatedStub$3("getArticleContent"),
|
|
676
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleCards 替代 */
|
|
677
|
-
getArticleCard: createDeprecatedStub$3("getArticleCard"),
|
|
678
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleInfo 替代 */
|
|
679
|
-
getArticleInfo: createDeprecatedStub$3("getArticleInfo"),
|
|
680
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchArticleListInfo 替代 */
|
|
681
|
-
getColumnInfo: createDeprecatedStub$3("getColumnInfo"),
|
|
682
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchUserSpaceInfo 替代 */
|
|
683
|
-
getUserProfileDetail: createDeprecatedStub$3("getUserProfileDetail"),
|
|
684
|
-
/** @deprecated 请使用 bilibiliFetcher.requestCaptchaFromVoucher 替代 */
|
|
685
|
-
applyVoucherCaptcha: createDeprecatedStub$3("applyVoucherCaptcha"),
|
|
686
|
-
/** @deprecated 请使用 bilibiliFetcher.validateCaptchaResult 替代 */
|
|
687
|
-
validateCaptcha: createDeprecatedStub$3("validateCaptcha"),
|
|
688
|
-
/** @deprecated 请使用 bilibiliFetcher.fetchVideoDanmaku 替代 */
|
|
689
|
-
getDanmaku: createDeprecatedStub$3("getDanmaku")
|
|
690
|
-
};
|
|
691
|
-
/**
|
|
692
|
-
* 创建绑定了cookie的B站API对象
|
|
693
|
-
*
|
|
694
|
-
* @deprecated v6 已废弃,请使用 createBoundBilibiliFetcher 替代
|
|
695
|
-
*/
|
|
696
|
-
const createBoundBilibiliApi = (_cookie, _requestConfig) => {
|
|
697
|
-
return { ...bilibili };
|
|
698
|
-
};
|
|
699
|
-
//#endregion
|
|
700
172
|
//#region src/model/events.ts
|
|
701
173
|
/**
|
|
702
174
|
* Amagi 事件系统
|
|
@@ -1009,7 +481,7 @@ const BilibiliBangumiStreamParamsSchema = zod.object({
|
|
|
1009
481
|
});
|
|
1010
482
|
/** 动态参数验证 */
|
|
1011
483
|
const BilibiliDynamicParamsSchema = zod.object({
|
|
1012
|
-
methodType: zod.
|
|
484
|
+
methodType: zod.literal("dynamicDetail", { error: "方法类型必须是\"dynamicDetail\"" }),
|
|
1013
485
|
dynamic_id: zod.string({ error: "动态ID必须是字符串" }).min(1, { error: "动态ID不能为空" })
|
|
1014
486
|
});
|
|
1015
487
|
/** 直播间参数验证 */
|
|
@@ -1091,7 +563,6 @@ const BilibiliValidationSchemas = {
|
|
|
1091
563
|
bangumiInfo: BilibiliBangumiInfoParamsSchema,
|
|
1092
564
|
bangumiStream: BilibiliBangumiStreamParamsSchema,
|
|
1093
565
|
dynamicDetail: BilibiliDynamicParamsSchema,
|
|
1094
|
-
dynamicCard: BilibiliDynamicParamsSchema,
|
|
1095
566
|
liveRoomInfo: BilibiliLiveParamsSchema,
|
|
1096
567
|
liveRoomInit: BilibiliLiveParamsSchema,
|
|
1097
568
|
loginStatus: BilibiliLoginParamsSchema,
|
|
@@ -1122,7 +593,6 @@ const BilibiliMethodRoutes = {
|
|
|
1122
593
|
bangumiInfo: "/fetch_bangumi_video_info",
|
|
1123
594
|
bangumiStream: "/fetch_bangumi_video_playurl",
|
|
1124
595
|
dynamicDetail: "/fetch_dynamic_info",
|
|
1125
|
-
dynamicCard: "/fetch_dynamic_card",
|
|
1126
596
|
liveRoomInfo: "/fetch_live_room_detail",
|
|
1127
597
|
liveRoomInit: "/fetch_liveroom_def",
|
|
1128
598
|
loginStatus: "/login_basic_info",
|
|
@@ -1699,18 +1169,20 @@ const xiaohongshuApiUrls = {
|
|
|
1699
1169
|
* @returns 完整的接口URL
|
|
1700
1170
|
*/
|
|
1701
1171
|
noteComments(data) {
|
|
1172
|
+
const baseUrl = "https://edith.xiaohongshu.com/api/sns/web/v2/comment/page";
|
|
1173
|
+
const params = {
|
|
1174
|
+
note_id: data.note_id,
|
|
1175
|
+
cursor: data.cursor ?? "",
|
|
1176
|
+
image_formats: [
|
|
1177
|
+
"jpg",
|
|
1178
|
+
"webp",
|
|
1179
|
+
"avif"
|
|
1180
|
+
].join(","),
|
|
1181
|
+
xsec_token: data.xsec_token
|
|
1182
|
+
};
|
|
1702
1183
|
return {
|
|
1703
1184
|
apiPath: "/api/sns/web/v2/comment/page",
|
|
1704
|
-
Url:
|
|
1705
|
-
note_id: data.note_id,
|
|
1706
|
-
cursor: data.cursor ?? "",
|
|
1707
|
-
image_formats: [
|
|
1708
|
-
"jpg",
|
|
1709
|
-
"webp",
|
|
1710
|
-
"avif"
|
|
1711
|
-
].join(","),
|
|
1712
|
-
xsec_token: data.xsec_token
|
|
1713
|
-
})}`
|
|
1185
|
+
Url: `${baseUrl}?${buildQueryString$1(params)}`
|
|
1714
1186
|
};
|
|
1715
1187
|
},
|
|
1716
1188
|
/**
|
|
@@ -1730,19 +1202,21 @@ const xiaohongshuApiUrls = {
|
|
|
1730
1202
|
* @returns 完整的接口URL
|
|
1731
1203
|
*/
|
|
1732
1204
|
userNoteList(data) {
|
|
1205
|
+
const baseUrl = "https://edith.xiaohongshu.com/api/sns/web/v1/user_posted";
|
|
1206
|
+
const params = {
|
|
1207
|
+
user_id: data.user_id,
|
|
1208
|
+
cursor: data.cursor ?? "",
|
|
1209
|
+
num: data.num ?? 30,
|
|
1210
|
+
image_formats: [
|
|
1211
|
+
"jpg",
|
|
1212
|
+
"webp",
|
|
1213
|
+
"avif"
|
|
1214
|
+
].join(","),
|
|
1215
|
+
xsec_source: "pc_feed"
|
|
1216
|
+
};
|
|
1733
1217
|
return {
|
|
1734
1218
|
apiPath: "/api/sns/web/v1/user_posted",
|
|
1735
|
-
Url:
|
|
1736
|
-
user_id: data.user_id,
|
|
1737
|
-
cursor: data.cursor ?? "",
|
|
1738
|
-
num: data.num ?? 30,
|
|
1739
|
-
image_formats: [
|
|
1740
|
-
"jpg",
|
|
1741
|
-
"webp",
|
|
1742
|
-
"avif"
|
|
1743
|
-
].join(","),
|
|
1744
|
-
xsec_source: "pc_feed"
|
|
1745
|
-
})}`
|
|
1219
|
+
Url: `${baseUrl}?${buildQueryString$1(params)}`
|
|
1746
1220
|
};
|
|
1747
1221
|
},
|
|
1748
1222
|
/**
|
|
@@ -1959,7 +1433,8 @@ const createErrorResponse = (error, message, code = 500, data) => {
|
|
|
1959
1433
|
async function fetchBilibiliInternal(methodType, options, config) {
|
|
1960
1434
|
const startTime = Date.now();
|
|
1961
1435
|
try {
|
|
1962
|
-
const
|
|
1436
|
+
const apiParams = { ...validateBilibiliParams(methodType, options) };
|
|
1437
|
+
const rawData = await fetchBilibili(apiParams, config.cookie, config.requestConfig);
|
|
1963
1438
|
const duration = Date.now() - startTime;
|
|
1964
1439
|
if (rawData.code !== 0) {
|
|
1965
1440
|
const errorMessage = rawData.message || "B站数据获取失败";
|
|
@@ -1971,11 +1446,12 @@ async function fetchBilibiliInternal(methodType, options, config) {
|
|
|
1971
1446
|
url: void 0,
|
|
1972
1447
|
duration
|
|
1973
1448
|
});
|
|
1974
|
-
|
|
1449
|
+
const amagiError = rawData.amagiError ?? {
|
|
1975
1450
|
errorDescription: errorMessage,
|
|
1976
1451
|
requestType: methodType,
|
|
1977
1452
|
requestUrl: void 0
|
|
1978
|
-
}
|
|
1453
|
+
};
|
|
1454
|
+
return createErrorResponse(amagiError, errorMessage, rawData.code, rawData);
|
|
1979
1455
|
}
|
|
1980
1456
|
const result = createSuccessResponse(rawData, "获取成功", 200);
|
|
1981
1457
|
emitApiSuccess({
|
|
@@ -2282,31 +1758,6 @@ async function fetchDynamicDetail(options, cookie, requestConfig) {
|
|
|
2282
1758
|
requestConfig
|
|
2283
1759
|
});
|
|
2284
1760
|
}
|
|
2285
|
-
/**
|
|
2286
|
-
* 获取B站动态卡片信息
|
|
2287
|
-
*
|
|
2288
|
-
* @deprecated v6.1.3 已废弃,B站官方已于 `2025-08-09` 删除原 `dynamic_svr` 接口。
|
|
2289
|
-
* 调用将返回错误信息
|
|
2290
|
-
* 计划于 v7.0.0 移除。
|
|
2291
|
-
*
|
|
2292
|
-
* @param options - 动态参数
|
|
2293
|
-
* @param options.dynamic_id - 动态 ID
|
|
2294
|
-
* @param cookie - B站 Cookie (可选)
|
|
2295
|
-
* @param requestConfig - 请求配置 (可选)
|
|
2296
|
-
* @returns 动态卡片数据(已停用,返回错误信息)
|
|
2297
|
-
* @example
|
|
2298
|
-
* ```typescript
|
|
2299
|
-
* const result = await fetchDynamicCard({ dynamic_id: '123456789' }, cookie)
|
|
2300
|
-
* // result.success === false,错误信息提示接口已停用
|
|
2301
|
-
* ```
|
|
2302
|
-
*/
|
|
2303
|
-
async function fetchDynamicCard(options, cookie, requestConfig) {
|
|
2304
|
-
checkDeprecation("fetchDynamicCard");
|
|
2305
|
-
return fetchBilibiliInternal("dynamicCard", options, {
|
|
2306
|
-
cookie,
|
|
2307
|
-
requestConfig
|
|
2308
|
-
});
|
|
2309
|
-
}
|
|
2310
1761
|
//#endregion
|
|
2311
1762
|
//#region src/model/fetchers/bilibili/live.ts
|
|
2312
1763
|
/**
|
|
@@ -2625,8 +2076,6 @@ function createBoundBilibiliFetcher(cookie, requestConfig) {
|
|
|
2625
2076
|
fetchUserSpaceInfo: (options, override) => fetchUserSpaceInfo(options, ...resolveRequest(override)),
|
|
2626
2077
|
fetchUploaderTotalViews: (options, override) => fetchUploaderTotalViews(options, ...resolveRequest(override)),
|
|
2627
2078
|
fetchDynamicDetail: (options, override) => fetchDynamicDetail(options, ...resolveRequest(override)),
|
|
2628
|
-
/** @deprecated v6.1.3 已废弃,调用将返回错误信息 */
|
|
2629
|
-
fetchDynamicCard: (options, override) => fetchDynamicCard(options, ...resolveRequest(override)),
|
|
2630
2079
|
fetchBangumiInfo: (options, override) => fetchBangumiInfo(options, ...resolveRequest(override)),
|
|
2631
2080
|
fetchBangumiStreamUrl: (options, override) => fetchBangumiStreamUrl(options, ...resolveRequest(override)),
|
|
2632
2081
|
fetchLiveRoomInfo: (options, override) => fetchLiveRoomInfo$2(options, ...resolveRequest(override)),
|
|
@@ -2673,7 +2122,6 @@ const bilibiliFetcher = {
|
|
|
2673
2122
|
fetchUserSpaceInfo,
|
|
2674
2123
|
fetchUploaderTotalViews,
|
|
2675
2124
|
fetchDynamicDetail,
|
|
2676
|
-
fetchDynamicCard,
|
|
2677
2125
|
fetchBangumiInfo,
|
|
2678
2126
|
fetchBangumiStreamUrl,
|
|
2679
2127
|
fetchLiveRoomInfo: fetchLiveRoomInfo$2,
|
|
@@ -3055,8 +2503,6 @@ function result_encrypt(long_str, num) {
|
|
|
3055
2503
|
case 3:
|
|
3056
2504
|
temp_int = long_int & 63;
|
|
3057
2505
|
result += constant["str"].charAt(temp_int);
|
|
3058
|
-
break;
|
|
3059
|
-
default: break;
|
|
3060
2506
|
}
|
|
3061
2507
|
}
|
|
3062
2508
|
return result;
|
|
@@ -3558,7 +3004,8 @@ var DouyinAPI = class {
|
|
|
3558
3004
|
}
|
|
3559
3005
|
/** 获取视频或图集数据 */
|
|
3560
3006
|
getWorkDetail(data) {
|
|
3561
|
-
|
|
3007
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/aweme/detail/";
|
|
3008
|
+
const params = {
|
|
3562
3009
|
...this.getBaseParams(),
|
|
3563
3010
|
aweme_id: data.aweme_id,
|
|
3564
3011
|
update_version_code: "170400",
|
|
@@ -3568,11 +3015,13 @@ var DouyinAPI = class {
|
|
|
3568
3015
|
screen_height: "1310",
|
|
3569
3016
|
round_trip_time: "150",
|
|
3570
3017
|
webid: "7351848354471872041"
|
|
3571
|
-
}
|
|
3018
|
+
};
|
|
3019
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3572
3020
|
}
|
|
3573
3021
|
/** 获取评论数据 */
|
|
3574
3022
|
getComments(data) {
|
|
3575
|
-
|
|
3023
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/comment/list/";
|
|
3024
|
+
const params = {
|
|
3576
3025
|
...this.getBaseParams(),
|
|
3577
3026
|
aweme_id: data.aweme_id,
|
|
3578
3027
|
cursor: data.cursor ?? 0,
|
|
@@ -3587,11 +3036,13 @@ var DouyinAPI = class {
|
|
|
3587
3036
|
screen_width: "1552",
|
|
3588
3037
|
screen_height: "970",
|
|
3589
3038
|
round_trip_time: "50"
|
|
3590
|
-
}
|
|
3039
|
+
};
|
|
3040
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3591
3041
|
}
|
|
3592
3042
|
/** 获取二级评论数据 */
|
|
3593
3043
|
getCommentReplies(data) {
|
|
3594
|
-
|
|
3044
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/comment/list/reply/";
|
|
3045
|
+
const params = {
|
|
3595
3046
|
device_platform: "webapp",
|
|
3596
3047
|
aid: "6383",
|
|
3597
3048
|
channel: "channel_pc_web",
|
|
@@ -3629,11 +3080,13 @@ var DouyinAPI = class {
|
|
|
3629
3080
|
webid: "7487210762873685515",
|
|
3630
3081
|
verifyFp: fp,
|
|
3631
3082
|
fp
|
|
3632
|
-
}
|
|
3083
|
+
};
|
|
3084
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3633
3085
|
}
|
|
3634
3086
|
/** 获取动图数据 */
|
|
3635
3087
|
getSlidesInfo(data) {
|
|
3636
|
-
|
|
3088
|
+
const baseUrl = "https://www.iesdouyin.com/web/api/v2/aweme/slidesinfo/";
|
|
3089
|
+
const params = {
|
|
3637
3090
|
reflow_source: "reflow_page",
|
|
3638
3091
|
web_id: "7326472315356857893",
|
|
3639
3092
|
device_id: "7326472315356857893",
|
|
@@ -3642,7 +3095,8 @@ var DouyinAPI = class {
|
|
|
3642
3095
|
msToken: douyinSign.Mstoken(116),
|
|
3643
3096
|
verifyFp: fp,
|
|
3644
3097
|
fp
|
|
3645
|
-
}
|
|
3098
|
+
};
|
|
3099
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3646
3100
|
}
|
|
3647
3101
|
/** 获取表情数据 */
|
|
3648
3102
|
getEmojiList() {
|
|
@@ -3650,7 +3104,8 @@ var DouyinAPI = class {
|
|
|
3650
3104
|
}
|
|
3651
3105
|
/** 获取用户主页视频数据 */
|
|
3652
3106
|
getUserVideoList(data) {
|
|
3653
|
-
|
|
3107
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/aweme/post/";
|
|
3108
|
+
const params = {
|
|
3654
3109
|
...this.getBaseParams(),
|
|
3655
3110
|
sec_user_id: data.sec_uid,
|
|
3656
3111
|
max_cursor: data.max_cursor ?? "0",
|
|
@@ -3668,11 +3123,13 @@ var DouyinAPI = class {
|
|
|
3668
3123
|
screen_height: "970",
|
|
3669
3124
|
round_trip_time: "50",
|
|
3670
3125
|
webid: "7338423850134226495"
|
|
3671
|
-
}
|
|
3126
|
+
};
|
|
3127
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3672
3128
|
}
|
|
3673
3129
|
/** 获取用户喜欢列表数据 */
|
|
3674
3130
|
getUserFavoriteList(data) {
|
|
3675
|
-
|
|
3131
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/aweme/favorite/";
|
|
3132
|
+
const params = {
|
|
3676
3133
|
...this.getBaseParams(),
|
|
3677
3134
|
sec_user_id: data.sec_uid,
|
|
3678
3135
|
max_cursor: data.max_cursor ?? "0",
|
|
@@ -3691,11 +3148,13 @@ var DouyinAPI = class {
|
|
|
3691
3148
|
screen_height: "1310",
|
|
3692
3149
|
round_trip_time: "0",
|
|
3693
3150
|
webid: "7487210762873685515"
|
|
3694
|
-
}
|
|
3151
|
+
};
|
|
3152
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3695
3153
|
}
|
|
3696
3154
|
/** 获取用户推荐列表数据 */
|
|
3697
3155
|
getUserRecommendList(data) {
|
|
3698
|
-
|
|
3156
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/familiar/recommend/feed/";
|
|
3157
|
+
const params = {
|
|
3699
3158
|
device_platform: "",
|
|
3700
3159
|
aid: "6383",
|
|
3701
3160
|
channel: "channel_pc_web",
|
|
@@ -3734,11 +3193,13 @@ var DouyinAPI = class {
|
|
|
3734
3193
|
msToken: douyinSign.Mstoken(184),
|
|
3735
3194
|
verifyFp: fp,
|
|
3736
3195
|
fp
|
|
3737
|
-
}
|
|
3196
|
+
};
|
|
3197
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3738
3198
|
}
|
|
3739
3199
|
/** 获取用户主页信息 */
|
|
3740
3200
|
getUserProfile(data) {
|
|
3741
|
-
|
|
3201
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/user/profile/other/";
|
|
3202
|
+
const params = {
|
|
3742
3203
|
...this.getBaseParams(),
|
|
3743
3204
|
publish_video_strategy_type: "2",
|
|
3744
3205
|
source: "channel_pc_web",
|
|
@@ -3750,11 +3211,13 @@ var DouyinAPI = class {
|
|
|
3750
3211
|
screen_height: "970",
|
|
3751
3212
|
round_trip_time: "0",
|
|
3752
3213
|
webid: "7327957959955580467"
|
|
3753
|
-
}
|
|
3214
|
+
};
|
|
3215
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3754
3216
|
}
|
|
3755
3217
|
/** 获取热点词数据 */
|
|
3756
3218
|
getSuggestWords(data) {
|
|
3757
|
-
|
|
3219
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/api/suggest_words/";
|
|
3220
|
+
const params = {
|
|
3758
3221
|
...this.getBaseParams(),
|
|
3759
3222
|
query: data.query,
|
|
3760
3223
|
business_id: "30088",
|
|
@@ -3765,91 +3228,103 @@ var DouyinAPI = class {
|
|
|
3765
3228
|
screen_height: "970",
|
|
3766
3229
|
round_trip_time: "50",
|
|
3767
3230
|
webid: "7327957959955580467"
|
|
3768
|
-
}
|
|
3231
|
+
};
|
|
3232
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3769
3233
|
}
|
|
3770
3234
|
/** 获取搜索数据 */
|
|
3771
3235
|
search(data) {
|
|
3772
3236
|
const searchType = data.type ?? "general";
|
|
3773
3237
|
const { verifyFp, fp, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3774
|
-
if (searchType === "user")
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
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
|
-
|
|
3238
|
+
if (searchType === "user") {
|
|
3239
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/discover/search/";
|
|
3240
|
+
const params = {
|
|
3241
|
+
...baseParamsWithoutFp,
|
|
3242
|
+
count: data.number ?? 10,
|
|
3243
|
+
disable_rs: "0",
|
|
3244
|
+
from_group_id: "",
|
|
3245
|
+
is_filter_search: "0",
|
|
3246
|
+
keyword: data.query,
|
|
3247
|
+
list_type: "single",
|
|
3248
|
+
need_filter_settings: "1",
|
|
3249
|
+
offset: "0",
|
|
3250
|
+
pc_libra_divert: "Windows",
|
|
3251
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3252
|
+
query_correct_type: "1",
|
|
3253
|
+
round_trip_time: "250",
|
|
3254
|
+
screen_height: "1310",
|
|
3255
|
+
screen_width: "2328",
|
|
3256
|
+
search_channel: "aweme_user_web",
|
|
3257
|
+
search_source: "switch_tab",
|
|
3258
|
+
support_dash: "1",
|
|
3259
|
+
support_h265: "1",
|
|
3260
|
+
version_code: "170400",
|
|
3261
|
+
version_name: "17.4.0",
|
|
3262
|
+
webid: "7521399115230610959",
|
|
3263
|
+
...data.search_id && { search_id: data.search_id }
|
|
3264
|
+
};
|
|
3265
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3266
|
+
} else if (searchType === "video") {
|
|
3267
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/search/item/";
|
|
3268
|
+
const params = {
|
|
3269
|
+
...baseParamsWithoutFp,
|
|
3270
|
+
count: data.number ?? 10,
|
|
3271
|
+
disable_rs: "0",
|
|
3272
|
+
enable_history: "1",
|
|
3273
|
+
from_group_id: "",
|
|
3274
|
+
is_filter_search: "0",
|
|
3275
|
+
keyword: data.query,
|
|
3276
|
+
list_type: "single",
|
|
3277
|
+
need_filter_settings: "1",
|
|
3278
|
+
offset: "0",
|
|
3279
|
+
pc_libra_divert: "Windows",
|
|
3280
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3281
|
+
query_correct_type: "1",
|
|
3282
|
+
round_trip_time: "50",
|
|
3283
|
+
screen_height: "1310",
|
|
3284
|
+
screen_width: "2328",
|
|
3285
|
+
search_channel: "aweme_video_web",
|
|
3286
|
+
search_source: "switch_tab",
|
|
3287
|
+
support_dash: "1",
|
|
3288
|
+
support_h265: "1",
|
|
3289
|
+
version_code: "170400",
|
|
3290
|
+
version_name: "17.4.0",
|
|
3291
|
+
webid: "7521399115230610959",
|
|
3292
|
+
...data.search_id && { search_id: data.search_id }
|
|
3293
|
+
};
|
|
3294
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3295
|
+
} else {
|
|
3296
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/general/search/stream/";
|
|
3297
|
+
const params = {
|
|
3298
|
+
...baseParamsWithoutFp,
|
|
3299
|
+
count: data.number ?? 10,
|
|
3300
|
+
disable_rs: "0",
|
|
3301
|
+
enable_history: "1",
|
|
3302
|
+
is_filter_search: "0",
|
|
3303
|
+
keyword: data.query,
|
|
3304
|
+
list_type: "",
|
|
3305
|
+
need_filter_settings: "1",
|
|
3306
|
+
offset: "0",
|
|
3307
|
+
pc_libra_divert: "Windows",
|
|
3308
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3309
|
+
query_correct_type: "1",
|
|
3310
|
+
round_trip_time: "0",
|
|
3311
|
+
screen_height: "1310",
|
|
3312
|
+
screen_width: "2328",
|
|
3313
|
+
search_channel: "aweme_general",
|
|
3314
|
+
search_source: "normal_search",
|
|
3315
|
+
support_dash: "1",
|
|
3316
|
+
support_h265: "1",
|
|
3317
|
+
version_code: "190600",
|
|
3318
|
+
version_name: "19.6.0",
|
|
3319
|
+
webid: "7521399115230610959"
|
|
3320
|
+
};
|
|
3321
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3322
|
+
}
|
|
3849
3323
|
}
|
|
3850
3324
|
/** 获取互动表情数据 */
|
|
3851
3325
|
getDynamicEmojiList() {
|
|
3852
|
-
|
|
3326
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/im/strategy/config";
|
|
3327
|
+
const params = {
|
|
3853
3328
|
device_platform: "webapp",
|
|
3854
3329
|
aid: "1128",
|
|
3855
3330
|
channel: "channel_pc_web",
|
|
@@ -3881,11 +3356,13 @@ var DouyinAPI = class {
|
|
|
3881
3356
|
msToken: douyinSign.Mstoken(116),
|
|
3882
3357
|
verifyFp: fp,
|
|
3883
3358
|
fp
|
|
3884
|
-
}
|
|
3359
|
+
};
|
|
3360
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3885
3361
|
}
|
|
3886
3362
|
/** 获取背景音乐数据 */
|
|
3887
3363
|
getMusicInfo(data) {
|
|
3888
|
-
|
|
3364
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/music/detail/";
|
|
3365
|
+
const params = {
|
|
3889
3366
|
device_platform: "webapp",
|
|
3890
3367
|
aid: "6383",
|
|
3891
3368
|
channel: "channel_pc_web",
|
|
@@ -3916,11 +3393,13 @@ var DouyinAPI = class {
|
|
|
3916
3393
|
msToken: douyinSign.Mstoken(116),
|
|
3917
3394
|
verifyFp: fp,
|
|
3918
3395
|
fp
|
|
3919
|
-
}
|
|
3396
|
+
};
|
|
3397
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3920
3398
|
}
|
|
3921
3399
|
/** 获取直播间信息 */
|
|
3922
3400
|
getLiveRoomInfo(data) {
|
|
3923
|
-
|
|
3401
|
+
const baseUrl = "https://live.douyin.com/webcast/room/web/enter/";
|
|
3402
|
+
const params = {
|
|
3924
3403
|
aid: "6383",
|
|
3925
3404
|
app_name: "douyin_web",
|
|
3926
3405
|
live_id: "1",
|
|
@@ -3943,18 +3422,22 @@ var DouyinAPI = class {
|
|
|
3943
3422
|
msToken: douyinSign.Mstoken(116),
|
|
3944
3423
|
verifyFp: fp,
|
|
3945
3424
|
fp
|
|
3946
|
-
}
|
|
3425
|
+
};
|
|
3426
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3947
3427
|
}
|
|
3948
3428
|
/** 申请登录二维码 */
|
|
3949
3429
|
getLoginQrcode(data) {
|
|
3950
|
-
|
|
3430
|
+
const baseUrl = "https://sso.douyin.com/get_qrcode/";
|
|
3431
|
+
const params = {
|
|
3951
3432
|
verifyFp: data.verify_fp,
|
|
3952
3433
|
fp: data.verify_fp
|
|
3953
|
-
}
|
|
3434
|
+
};
|
|
3435
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3954
3436
|
}
|
|
3955
3437
|
/** 获取弹幕数据 */
|
|
3956
3438
|
getDanmakuList(data) {
|
|
3957
|
-
|
|
3439
|
+
const baseUrl = "https://www-hj.douyin.com/aweme/v1/web/danmaku/get_v2/";
|
|
3440
|
+
const params = {
|
|
3958
3441
|
...this.getBaseParams(),
|
|
3959
3442
|
app_name: "aweme",
|
|
3960
3443
|
format: "json",
|
|
@@ -3981,7 +3464,8 @@ var DouyinAPI = class {
|
|
|
3981
3464
|
msToken: douyinSign.Mstoken(116),
|
|
3982
3465
|
verifyFp: fp,
|
|
3983
3466
|
fp
|
|
3984
|
-
}
|
|
3467
|
+
};
|
|
3468
|
+
return `${baseUrl}?${buildQueryString(params)}`;
|
|
3985
3469
|
}
|
|
3986
3470
|
};
|
|
3987
3471
|
/**
|
|
@@ -4003,7 +3487,6 @@ const douyinApiUrls = new DouyinAPI();
|
|
|
4003
3487
|
* 提供抖音各类数据的获取功能,包括视频、评论、用户等
|
|
4004
3488
|
*
|
|
4005
3489
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
4006
|
-
* 循环依赖链:DataFetchers → getdata → platform/douyin → DataFetchers
|
|
4007
3490
|
*
|
|
4008
3491
|
* @module platform/douyin/getdata
|
|
4009
3492
|
*/
|
|
@@ -4280,7 +3763,8 @@ const DouyinData = async (data, cookie, requestConfig) => {
|
|
|
4280
3763
|
signType: null,
|
|
4281
3764
|
processRawResponse: (raw) => {
|
|
4282
3765
|
if (!isUserSearch && !isVideoSearch) {
|
|
4283
|
-
const
|
|
3766
|
+
const chunks = typeof raw === "string" ? parseDouyinMultiJson(raw) : [raw];
|
|
3767
|
+
const responses = filterSearchResponses(chunks);
|
|
4284
3768
|
if (responses.length === 0) return raw;
|
|
4285
3769
|
const mergedData = [];
|
|
4286
3770
|
let lastValid = {};
|
|
@@ -4659,7 +4143,8 @@ const filterSearchResponses = (objs) => {
|
|
|
4659
4143
|
async function fetchDouyinInternal(methodType, options, config) {
|
|
4660
4144
|
const startTime = Date.now();
|
|
4661
4145
|
try {
|
|
4662
|
-
const
|
|
4146
|
+
const apiParams = { ...validateDouyinParams(methodType, options) };
|
|
4147
|
+
const rawData = await DouyinData(apiParams, config.cookie, config.requestConfig);
|
|
4663
4148
|
const duration = Date.now() - startTime;
|
|
4664
4149
|
if (rawData.data === "" || rawData.status_code !== 0) {
|
|
4665
4150
|
emitApiError({
|
|
@@ -5267,11 +4752,13 @@ var API = class {
|
|
|
5267
4752
|
* @returns 请求配置
|
|
5268
4753
|
*/
|
|
5269
4754
|
profilePublic(data) {
|
|
4755
|
+
const count = "count" in data ? data.count ?? 12 : 12;
|
|
4756
|
+
const pcursor = "pcursor" in data ? data.pcursor ?? "" : "";
|
|
5270
4757
|
return createKuaishouLiveApiRequest("profilePublic", "/live_api/profile/public", {
|
|
5271
4758
|
caver: 2,
|
|
5272
|
-
count
|
|
4759
|
+
count,
|
|
5273
4760
|
hasMore: true,
|
|
5274
|
-
pcursor
|
|
4761
|
+
pcursor,
|
|
5275
4762
|
principalId: data.principalId,
|
|
5276
4763
|
privacy: "public"
|
|
5277
4764
|
}, { signPath: "/rest/k/feed/profile" });
|
|
@@ -5435,6 +4922,7 @@ var API = class {
|
|
|
5435
4922
|
* @returns 请求配置
|
|
5436
4923
|
*/
|
|
5437
4924
|
liveReco(gameId) {
|
|
4925
|
+
const normalizedGameId = Number(gameId) > 0 ? Number(gameId) : 1001;
|
|
5438
4926
|
return createKuaishouLiveApiRequest("liveReco", "/live_api/liveroom/reco", {}, {
|
|
5439
4927
|
method: "POST",
|
|
5440
4928
|
requiresSign: false,
|
|
@@ -5444,7 +4932,7 @@ var API = class {
|
|
|
5444
4932
|
followingWeight: 50
|
|
5445
4933
|
},
|
|
5446
4934
|
gameFavour: [{
|
|
5447
|
-
gameId:
|
|
4935
|
+
gameId: normalizedGameId,
|
|
5448
4936
|
totalStayLength: 100
|
|
5449
4937
|
}]
|
|
5450
4938
|
}
|
|
@@ -5677,8 +5165,10 @@ const maskKuaishouHudrPayload = (payload) => {
|
|
|
5677
5165
|
* @returns `HUDR_` 的完整结果及若干中间态,便于对拍与调试
|
|
5678
5166
|
*/
|
|
5679
5167
|
const deriveKuaishouHudrBody = (context) => {
|
|
5680
|
-
const
|
|
5681
|
-
const
|
|
5168
|
+
const payload = buildKuaishouHudrPayload(context);
|
|
5169
|
+
const maskedPayload = maskKuaishouHudrPayload(payload);
|
|
5170
|
+
const encrypted = new KuaishouChaChaCipher(KUAISHOU_HUDR_CHACHA_KEY, KUAISHOU_HUDR_CHACHA_NONCE).encrypt(maskedPayload);
|
|
5171
|
+
const body = encodeBase64Url(encrypted);
|
|
5682
5172
|
return {
|
|
5683
5173
|
body,
|
|
5684
5174
|
full: `${KUAISHOU_HUDR_PREFIX}${body}`,
|
|
@@ -6190,7 +5680,9 @@ const KUAISHOU_HE_RANDOM_MAX = 0xffffffffffff;
|
|
|
6190
5680
|
* @returns `$HE_` 载荷中的 4 字节 hash field hex
|
|
6191
5681
|
*/
|
|
6192
5682
|
const deriveKuaishouHeHashFieldHex = (signInput, hudrBody) => {
|
|
6193
|
-
|
|
5683
|
+
const hashInput = `${signInput}HUDR_${hudrBody}`;
|
|
5684
|
+
const digestHex = bytesToLowerHex(deriveKuaishouCts(deriveKuaishouB2sa(hashInput))).slice(0, 8);
|
|
5685
|
+
return bytesToLowerHex(xorByteArrays(hexToSignedBytes(digestHex), KUAISHOU_HE_INPUT_XOR_MASK));
|
|
6194
5686
|
};
|
|
6195
5687
|
/**
|
|
6196
5688
|
* 推导快手签名中的 `$HE_` 段。
|
|
@@ -6530,7 +6022,6 @@ var kuaishouSign = class {
|
|
|
6530
6022
|
* 快手数据获取模块
|
|
6531
6023
|
*
|
|
6532
6024
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
6533
|
-
* 循环依赖链:DataFetchers → getdata → platform/kuaishou → DataFetchers
|
|
6534
6025
|
*/
|
|
6535
6026
|
const KUAISHOU_PROFILE_TAB_TYPE_MAP = {
|
|
6536
6027
|
public: "public",
|
|
@@ -7212,7 +6703,8 @@ const KuaishouData = async (data, cookie, requestConfig) => {
|
|
|
7212
6703
|
if (!liveDetailData) return liveRoomInfo;
|
|
7213
6704
|
const userInfo = isErrorDetailLike(userInfoPayload) ? void 0 : userInfoPayload?.data?.userInfo;
|
|
7214
6705
|
const sensitiveInfo = isErrorDetailLike(sensitivePayload) ? void 0 : sensitivePayload?.data?.sensitiveUserInfo;
|
|
7215
|
-
const
|
|
6706
|
+
const currentAuthor = mergeKuaishouLiveAuthor(liveDetailData?.author, userInfo, sensitiveInfo);
|
|
6707
|
+
const currentLiveRoomItem = mapLiveDetailToLiveRoomPlayItem(liveDetailData, currentAuthor);
|
|
7216
6708
|
const liveStreamId = currentLiveRoomItem.liveStream?.id ?? currentLiveRoomItem.config?.liveStreamId;
|
|
7217
6709
|
const currentGameId = liveDetailData?.gameInfo?.id ?? liveDetailData?.gameInfo?.gameId;
|
|
7218
6710
|
const liveDetailWebsocketMeta = resolveKuaishouLiveDetailWebsocketMeta(liveDetailData);
|
|
@@ -7230,7 +6722,8 @@ const KuaishouData = async (data, cookie, requestConfig) => {
|
|
|
7230
6722
|
shouldFetchRecommendList ? fetchKuaishouLiveApiPayload(data.methodType, kuaishouApiUrls.liveReco(currentGameId), refererPath, { allowResult2: true }) : Promise.resolve(null)
|
|
7231
6723
|
]);
|
|
7232
6724
|
const resolvedRecommendList = !isErrorDetailLike(recoPayload) && Array.isArray(recoPayload?.data?.list) ? recoPayload.data.list : liveDetailRecommendList;
|
|
7233
|
-
const
|
|
6725
|
+
const recoPlayList = Array.isArray(resolvedRecommendList) ? resolvedRecommendList.map((item) => mapRecoItemToLiveRoomPlayItem(item)) : [];
|
|
6726
|
+
const nextPlayList = dedupeLiveRoomPlayList([currentLiveRoomItem, ...recoPlayList]);
|
|
7234
6727
|
return {
|
|
7235
6728
|
...liveRoomInfo,
|
|
7236
6729
|
principalId: data.principalId,
|
|
@@ -7341,7 +6834,8 @@ const GlobalGetData$2 = async (type, options, config) => {
|
|
|
7341
6834
|
async function fetchKuaishouInternal(methodType, options, config) {
|
|
7342
6835
|
const startTime = Date.now();
|
|
7343
6836
|
try {
|
|
7344
|
-
const
|
|
6837
|
+
const apiParams = { ...validateKuaishouParams(methodType, options) };
|
|
6838
|
+
const rawData = await KuaishouData(apiParams, config.cookie, config.requestConfig);
|
|
7345
6839
|
const duration = Date.now() - startTime;
|
|
7346
6840
|
if (rawData.code && Object.values(kuaishouAPIErrorCode).includes(rawData.code)) {
|
|
7347
6841
|
emitApiError({
|
|
@@ -7600,18 +7094,19 @@ const XiaohongshuData = async (data, cookie, requestConfig) => {
|
|
|
7600
7094
|
...requestConfig?.headers ?? {}
|
|
7601
7095
|
}
|
|
7602
7096
|
};
|
|
7097
|
+
const userData = await GlobalGetData$1(data.methodType, {
|
|
7098
|
+
...baseRequestConfig,
|
|
7099
|
+
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7100
|
+
headers: {
|
|
7101
|
+
...baseRequestConfig.headers,
|
|
7102
|
+
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7103
|
+
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7104
|
+
"x-t": xiaohongshuSign.generateXT()
|
|
7105
|
+
}
|
|
7106
|
+
});
|
|
7603
7107
|
return {
|
|
7604
7108
|
code: 0,
|
|
7605
|
-
data: extractCreatorInfoFromHtml(
|
|
7606
|
-
...baseRequestConfig,
|
|
7607
|
-
url: xiaohongshuApiUrls.userProfile(data).Url,
|
|
7608
|
-
headers: {
|
|
7609
|
-
...baseRequestConfig.headers,
|
|
7610
|
-
"x-s": xiaohongshuSign.generateXSGet(xiaohongshuApiUrls.userProfile(data).apiPath, xiaohongshuSign.extractA1FromCookie(requestCookie), "xhs-pc-web"),
|
|
7611
|
-
"x-s-common": xiaohongshuSign.generateXSCommon(requestCookie),
|
|
7612
|
-
"x-t": xiaohongshuSign.generateXT()
|
|
7613
|
-
}
|
|
7614
|
-
})),
|
|
7109
|
+
data: extractCreatorInfoFromHtml(userData),
|
|
7615
7110
|
msg: "success"
|
|
7616
7111
|
};
|
|
7617
7112
|
}
|
|
@@ -7725,7 +7220,8 @@ const sortTypeMapping = {
|
|
|
7725
7220
|
async function fetchXiaohongshuInternal(methodType, options, config) {
|
|
7726
7221
|
const startTime = Date.now();
|
|
7727
7222
|
try {
|
|
7728
|
-
const
|
|
7223
|
+
const apiParams = { ...validateXiaohongshuParams(methodType, options) };
|
|
7224
|
+
const rawData = await XiaohongshuData(apiParams, config.cookie, config.requestConfig);
|
|
7729
7225
|
const duration = Date.now() - startTime;
|
|
7730
7226
|
if (rawData.code && Object.values(xiaohongshuAPIErrorCode).includes(rawData.code)) {
|
|
7731
7227
|
emitApiError({
|
|
@@ -8149,106 +7645,6 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
8149
7645
|
};
|
|
8150
7646
|
};
|
|
8151
7647
|
//#endregion
|
|
8152
|
-
//#region src/model/logger.ts
|
|
8153
|
-
/**
|
|
8154
|
-
* @deprecated v6 已废弃日志模块,请使用事件系统替代
|
|
8155
|
-
* @see {@link ../events.ts} 使用 amagiEvents 监听日志事件
|
|
8156
|
-
*
|
|
8157
|
-
* 迁移示例:
|
|
8158
|
-
* ```typescript
|
|
8159
|
-
* import { amagiEvents } from '@ikenxuan/amagi'
|
|
8160
|
-
*
|
|
8161
|
-
* amagiEvents.on('log:info', (data) => console.log(data.message))
|
|
8162
|
-
* amagiEvents.on('log:error', (data) => console.error(data.message))
|
|
8163
|
-
* ```
|
|
8164
|
-
*/
|
|
8165
|
-
/**
|
|
8166
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8167
|
-
* 初始化 logger 配置 - 此函数现在为空操作
|
|
8168
|
-
*/
|
|
8169
|
-
const initLogger = () => {};
|
|
8170
|
-
/**
|
|
8171
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8172
|
-
* 简化的日志类,仅发射事件,不再依赖 log4js
|
|
8173
|
-
*/
|
|
8174
|
-
var SimpleLogger = class {
|
|
8175
|
-
chalk;
|
|
8176
|
-
red;
|
|
8177
|
-
green;
|
|
8178
|
-
yellow;
|
|
8179
|
-
blue;
|
|
8180
|
-
magenta;
|
|
8181
|
-
cyan;
|
|
8182
|
-
white;
|
|
8183
|
-
gray;
|
|
8184
|
-
constructor() {
|
|
8185
|
-
this.chalk = new Chalk();
|
|
8186
|
-
this.red = this.chalk.red;
|
|
8187
|
-
this.green = this.chalk.green;
|
|
8188
|
-
this.yellow = this.chalk.yellow;
|
|
8189
|
-
this.blue = this.chalk.blue;
|
|
8190
|
-
this.magenta = this.chalk.magenta;
|
|
8191
|
-
this.cyan = this.chalk.cyan;
|
|
8192
|
-
this.white = this.chalk.white;
|
|
8193
|
-
this.gray = this.chalk.gray;
|
|
8194
|
-
}
|
|
8195
|
-
info(message, ...args) {
|
|
8196
|
-
emitLog("info", String(message), ...args);
|
|
8197
|
-
}
|
|
8198
|
-
warn(message, ...args) {
|
|
8199
|
-
emitLog("warn", String(message), ...args);
|
|
8200
|
-
}
|
|
8201
|
-
error(message, ...args) {
|
|
8202
|
-
emitLog("error", String(message), ...args);
|
|
8203
|
-
}
|
|
8204
|
-
mark(message, ...args) {
|
|
8205
|
-
emitLog("mark", String(message), ...args);
|
|
8206
|
-
}
|
|
8207
|
-
debug(message, ...args) {
|
|
8208
|
-
emitLog("debug", String(message), ...args);
|
|
8209
|
-
}
|
|
8210
|
-
};
|
|
8211
|
-
/**
|
|
8212
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8213
|
-
*/
|
|
8214
|
-
const logger = new SimpleLogger();
|
|
8215
|
-
/**
|
|
8216
|
-
* @deprecated v6 已废弃,请使用事件系统替代
|
|
8217
|
-
*/
|
|
8218
|
-
const httpLogger = new SimpleLogger();
|
|
8219
|
-
/**
|
|
8220
|
-
* @deprecated v6 已废弃,请使用事件系统监听 http:response 事件
|
|
8221
|
-
* 创建一个日志中间件,用于记录特定请求的详细信息
|
|
8222
|
-
* @param pathsToLog 指定需要记录日志的请求路径数组如果未提供,则记录所有请求的日志
|
|
8223
|
-
* @returns
|
|
8224
|
-
*/
|
|
8225
|
-
const logMiddleware = (pathsToLog) => {
|
|
8226
|
-
return (req, res, next) => {
|
|
8227
|
-
if (!pathsToLog || pathsToLog.some((path) => req.url.startsWith(path))) {
|
|
8228
|
-
const startTime = Date.now();
|
|
8229
|
-
const url = req.url;
|
|
8230
|
-
const method = req.method;
|
|
8231
|
-
const clientIP = req.headers["x-forwarded-for"] ?? req.socket.remoteAddress;
|
|
8232
|
-
res.on("finish", () => {
|
|
8233
|
-
const responseTime = Date.now() - startTime;
|
|
8234
|
-
const statusCode = res.statusCode;
|
|
8235
|
-
const requestSize = req.headers["content-length"] ?? "0";
|
|
8236
|
-
const responseSize = res.get("content-length") ?? "0";
|
|
8237
|
-
emitHttpResponse({
|
|
8238
|
-
method,
|
|
8239
|
-
url,
|
|
8240
|
-
statusCode,
|
|
8241
|
-
responseTime,
|
|
8242
|
-
clientIP: String(clientIP),
|
|
8243
|
-
requestSize: `${requestSize}B`,
|
|
8244
|
-
responseSize: `${responseSize}B`
|
|
8245
|
-
});
|
|
8246
|
-
});
|
|
8247
|
-
}
|
|
8248
|
-
next();
|
|
8249
|
-
};
|
|
8250
|
-
};
|
|
8251
|
-
//#endregion
|
|
8252
7648
|
//#region src/platform/bilibili/qtparam.ts
|
|
8253
7649
|
/**
|
|
8254
7650
|
* 生成B站视频流请求参数
|
|
@@ -8567,7 +7963,6 @@ const wbi_sign = async (BASEURL, cookie) => {
|
|
|
8567
7963
|
* 提供 B站各类数据的获取功能,包括视频、评论、用户、番剧等
|
|
8568
7964
|
*
|
|
8569
7965
|
* 注意:为避免循环依赖,此文件直接从具体模块导入,而不是从平台 index 文件导入
|
|
8570
|
-
* 循环依赖链:DataFetchers → getdata → platform/bilibili → DataFetchers
|
|
8571
7966
|
*
|
|
8572
7967
|
* @module platform/bilibili/getdata
|
|
8573
7968
|
*/
|
|
@@ -8587,10 +7982,11 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8587
7982
|
url: bilibiliApiUrls.getVideoInfo({ bvid: data.bvid })
|
|
8588
7983
|
});
|
|
8589
7984
|
case "videoStream": {
|
|
8590
|
-
const
|
|
7985
|
+
const baseUrl = bilibiliApiUrls.getVideoStream({
|
|
8591
7986
|
avid: data.avid,
|
|
8592
7987
|
cid: data.cid
|
|
8593
|
-
})
|
|
7988
|
+
});
|
|
7989
|
+
const sign = await qtparam(baseUrl, baseRequestConfig.headers?.Cookie);
|
|
8594
7990
|
return await GlobalGetData(data.methodType, {
|
|
8595
7991
|
...baseRequestConfig,
|
|
8596
7992
|
url: bilibiliApiUrls.getVideoStream({
|
|
@@ -8677,10 +8073,11 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8677
8073
|
});
|
|
8678
8074
|
}
|
|
8679
8075
|
case "bangumiStream": {
|
|
8680
|
-
const
|
|
8076
|
+
const baseUrl = bilibiliApiUrls.getBangumiStream({
|
|
8681
8077
|
cid: data.cid,
|
|
8682
8078
|
ep_id: data.ep_id.replace("ep", "")
|
|
8683
|
-
})
|
|
8079
|
+
});
|
|
8080
|
+
const sign = await qtparam(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8684
8081
|
return await GlobalGetData(data.methodType, {
|
|
8685
8082
|
...baseRequestConfig,
|
|
8686
8083
|
url: bilibiliApiUrls.getBangumiStream({
|
|
@@ -8716,12 +8113,6 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8716
8113
|
url: bilibiliApiUrls.getDynamicDetail({ dynamic_id: data.dynamic_id })
|
|
8717
8114
|
});
|
|
8718
8115
|
}
|
|
8719
|
-
case "dynamicCard": return {
|
|
8720
|
-
code: -404,
|
|
8721
|
-
message: "接口已停用:B站官方已于 `2025-08-09` 删除 dynamic_svr 接口,fetchDynamicCard 方法已废弃,调用讲返回错误信息",
|
|
8722
|
-
ttl: 1,
|
|
8723
|
-
data: null
|
|
8724
|
-
};
|
|
8725
8116
|
case "userCard": {
|
|
8726
8117
|
const { host_mid } = data;
|
|
8727
8118
|
return await GlobalGetData(data.methodType, {
|
|
@@ -8734,7 +8125,8 @@ const fetchBilibili = async (data, cookie, requestConfig) => {
|
|
|
8734
8125
|
url: bilibiliApiUrls.getUserLiveStatus({ host_mid: data.host_mid })
|
|
8735
8126
|
});
|
|
8736
8127
|
case "userSpaceInfo": {
|
|
8737
|
-
const
|
|
8128
|
+
const baseUrl = bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid });
|
|
8129
|
+
const wbiSignQuery = await wbi_sign(baseUrl, baseRequestConfig.headers?.cookie);
|
|
8738
8130
|
return await GlobalGetData(data.methodType, {
|
|
8739
8131
|
...baseRequestConfig,
|
|
8740
8132
|
url: bilibiliApiUrls.getUserSpaceInfo({ host_mid: data.host_mid }) + wbiSignQuery
|
|
@@ -9085,10 +8477,11 @@ var ValidationError = class ValidationError extends Error {
|
|
|
9085
8477
|
* @returns 验证错误实例
|
|
9086
8478
|
*/
|
|
9087
8479
|
static fromZodError(zodError, requestPath) {
|
|
9088
|
-
|
|
8480
|
+
const errors = zodError.issues.map((err) => ({
|
|
9089
8481
|
field: err.path.join("."),
|
|
9090
8482
|
message: err.message
|
|
9091
|
-
}))
|
|
8483
|
+
}));
|
|
8484
|
+
return new ValidationError("参数验证失败", errors, requestPath);
|
|
9092
8485
|
}
|
|
9093
8486
|
};
|
|
9094
8487
|
/**
|
|
@@ -9112,7 +8505,10 @@ const handleError = (error, requestPath) => {
|
|
|
9112
8505
|
platform: error.platform,
|
|
9113
8506
|
requestPath
|
|
9114
8507
|
};
|
|
9115
|
-
if (error instanceof zod.ZodError)
|
|
8508
|
+
if (error instanceof zod.ZodError) {
|
|
8509
|
+
const validationError = ValidationError.fromZodError(error, requestPath);
|
|
8510
|
+
return handleError(validationError, requestPath);
|
|
8511
|
+
}
|
|
9116
8512
|
return {
|
|
9117
8513
|
code: 500,
|
|
9118
8514
|
message: error instanceof Error ? error.message : "未知错误",
|
|
@@ -9223,71 +8619,7 @@ const bilibiliUtils = {
|
|
|
9223
8619
|
bv2av
|
|
9224
8620
|
},
|
|
9225
8621
|
danmaku: { parseDmSegMobileReply },
|
|
9226
|
-
bilibiliApiUrls
|
|
9227
|
-
api: bilibili
|
|
9228
|
-
};
|
|
9229
|
-
//#endregion
|
|
9230
|
-
//#region src/platform/douyin/DouyinApi.ts
|
|
9231
|
-
/**
|
|
9232
|
-
* 创建废弃的 API 存根函数
|
|
9233
|
-
*/
|
|
9234
|
-
const createDeprecatedStub$2 = (methodName) => {
|
|
9235
|
-
return (..._args) => {
|
|
9236
|
-
checkDeprecation("getDouyinData");
|
|
9237
|
-
throw new Error(`douyin.${methodName} 已废弃,请使用 douyinFetcher 替代`);
|
|
9238
|
-
};
|
|
9239
|
-
};
|
|
9240
|
-
/**
|
|
9241
|
-
* 封装了所有抖音相关的API请求,采用对象化的方式组织。
|
|
9242
|
-
*
|
|
9243
|
-
* @deprecated v6 已废弃,请使用 douyinFetcher 或 client.douyin.fetcher 替代
|
|
9244
|
-
*/
|
|
9245
|
-
const douyin = {
|
|
9246
|
-
/** @deprecated 请使用 douyinFetcher.fetchTextWork 替代 */
|
|
9247
|
-
getTextWorkInfo: createDeprecatedStub$2("getTextWorkInfo"),
|
|
9248
|
-
/** @deprecated 请使用 douyinFetcher.parseWork 替代 */
|
|
9249
|
-
getWorkInfo: createDeprecatedStub$2("getWorkInfo"),
|
|
9250
|
-
/** @deprecated 请使用 douyinFetcher.fetchVideoWork 替代 */
|
|
9251
|
-
getVideoWorkInfo: createDeprecatedStub$2("getVideoWorkInfo"),
|
|
9252
|
-
/** @deprecated 请使用 douyinFetcher.fetchImageAlbumWork 替代 */
|
|
9253
|
-
getImageAlbumWorkInfo: createDeprecatedStub$2("getImageAlbumWorkInfo"),
|
|
9254
|
-
/** @deprecated 请使用 douyinFetcher.fetchSlidesWork 替代 */
|
|
9255
|
-
getSlidesWorkInfo: createDeprecatedStub$2("getSlidesWorkInfo"),
|
|
9256
|
-
/** @deprecated 请使用 douyinFetcher.fetchComments 替代 */
|
|
9257
|
-
getComments: createDeprecatedStub$2("getComments"),
|
|
9258
|
-
/** @deprecated 请使用 douyinFetcher.fetchCommentReplies 替代 */
|
|
9259
|
-
getCommentReplies: createDeprecatedStub$2("getCommentReplies"),
|
|
9260
|
-
/** @deprecated 请使用 douyinFetcher.fetchUserProfile 替代 */
|
|
9261
|
-
getUserProfile: createDeprecatedStub$2("getUserProfile"),
|
|
9262
|
-
/** @deprecated 请使用 douyinFetcher.fetchEmojiList 替代 */
|
|
9263
|
-
getEmojiList: createDeprecatedStub$2("getEmojiList"),
|
|
9264
|
-
/** @deprecated 请使用 douyinFetcher.fetchDynamicEmojiList 替代 */
|
|
9265
|
-
getEmojiProList: createDeprecatedStub$2("getEmojiProList"),
|
|
9266
|
-
/** @deprecated 请使用 douyinFetcher.fetchUserVideoList 替代 */
|
|
9267
|
-
getUserVideos: createDeprecatedStub$2("getUserVideos"),
|
|
9268
|
-
/** @deprecated 请使用 douyinFetcher.fetchMusicInfo 替代 */
|
|
9269
|
-
getMusicInfo: createDeprecatedStub$2("getMusicInfo"),
|
|
9270
|
-
/** @deprecated 请使用 douyinFetcher.fetchSuggestWords 替代 */
|
|
9271
|
-
getSuggestWords: createDeprecatedStub$2("getSuggestWords"),
|
|
9272
|
-
/** @deprecated 请使用 douyinFetcher.searchContent 替代 */
|
|
9273
|
-
search: createDeprecatedStub$2("search"),
|
|
9274
|
-
/** @deprecated 请使用 douyinFetcher.fetchLiveRoomInfo 替代 */
|
|
9275
|
-
getLiveRoomInfo: createDeprecatedStub$2("getLiveRoomInfo"),
|
|
9276
|
-
/** @deprecated 请使用 douyinFetcher.fetchDanmakuList 替代 */
|
|
9277
|
-
getDanmaku: createDeprecatedStub$2("getDanmaku"),
|
|
9278
|
-
/** @deprecated 请使用 douyinFetcher 的具体方法替代 */
|
|
9279
|
-
invoke: createDeprecatedStub$2("invoke")
|
|
9280
|
-
};
|
|
9281
|
-
/**
|
|
9282
|
-
* 创建绑定了cookie的抖音API对象
|
|
9283
|
-
*
|
|
9284
|
-
* @deprecated v6 已废弃,请使用 createBoundDouyinFetcher 替代
|
|
9285
|
-
*/
|
|
9286
|
-
const createBoundDouyinApi = (_cookie, _requestConfig) => {
|
|
9287
|
-
return {
|
|
9288
|
-
...douyin,
|
|
9289
|
-
getSearchData: createDeprecatedStub$2("getSearchData")
|
|
9290
|
-
};
|
|
8622
|
+
bilibiliApiUrls
|
|
9291
8623
|
};
|
|
9292
8624
|
//#endregion
|
|
9293
8625
|
//#region src/platform/douyin/routes.ts
|
|
@@ -9341,46 +8673,7 @@ const createDouyinRoutes = (cookie, requestConfig = getDouyinDefaultConfig(cooki
|
|
|
9341
8673
|
/** 抖音相关功能模块 (工具集) */
|
|
9342
8674
|
const douyinUtils = {
|
|
9343
8675
|
sign: douyinSign,
|
|
9344
|
-
douyinApiUrls
|
|
9345
|
-
api: douyin
|
|
9346
|
-
};
|
|
9347
|
-
//#endregion
|
|
9348
|
-
//#region src/platform/kuaishou/KuaishouApi.ts
|
|
9349
|
-
/**
|
|
9350
|
-
* 创建废弃的 API 存根函数
|
|
9351
|
-
*/
|
|
9352
|
-
const createDeprecatedStub$1 = (methodName) => {
|
|
9353
|
-
return (..._args) => {
|
|
9354
|
-
checkDeprecation("getKuaishouData");
|
|
9355
|
-
throw new Error(`kuaishou.${methodName} 已废弃,请使用 kuaishouFetcher 替代`);
|
|
9356
|
-
};
|
|
9357
|
-
};
|
|
9358
|
-
/**
|
|
9359
|
-
* 快手相关 API 的命名空间。
|
|
9360
|
-
*
|
|
9361
|
-
* @deprecated v6 已废弃,请使用 kuaishouFetcher 或 client.kuaishou.fetcher 替代
|
|
9362
|
-
*/
|
|
9363
|
-
const kuaishou = {
|
|
9364
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchVideoWork 替代 */
|
|
9365
|
-
getWorkInfo: createDeprecatedStub$1("getWorkInfo"),
|
|
9366
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchWorkComments 替代 */
|
|
9367
|
-
getComments: createDeprecatedStub$1("getComments"),
|
|
9368
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchUserProfile 替代 */
|
|
9369
|
-
getUserProfile: createDeprecatedStub$1("getUserProfile"),
|
|
9370
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchUserWorkList 替代 */
|
|
9371
|
-
getUserWorkList: createDeprecatedStub$1("getUserWorkList"),
|
|
9372
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchLiveRoomInfo 替代 */
|
|
9373
|
-
getLiveRoomInfo: createDeprecatedStub$1("getLiveRoomInfo"),
|
|
9374
|
-
/** @deprecated 请使用 kuaishouFetcher.fetchEmojiList 替代 */
|
|
9375
|
-
getEmojiList: createDeprecatedStub$1("getEmojiList")
|
|
9376
|
-
};
|
|
9377
|
-
/**
|
|
9378
|
-
* 创建绑定了cookie的快手API对象
|
|
9379
|
-
*
|
|
9380
|
-
* @deprecated v6 已废弃,请使用 createBoundKuaishouFetcher 替代
|
|
9381
|
-
*/
|
|
9382
|
-
const createBoundKuaishouApi = (_cookie, _requestConfig) => {
|
|
9383
|
-
return { ...kuaishou };
|
|
8676
|
+
douyinApiUrls
|
|
9384
8677
|
};
|
|
9385
8678
|
//#endregion
|
|
9386
8679
|
//#region src/platform/kuaishou/routes.ts
|
|
@@ -9434,48 +8727,7 @@ const createKuaishouRoutes = (cookie, requestConfig = getKuaishouDefaultConfig(c
|
|
|
9434
8727
|
/** 快手相关功能模块 (工具集) */
|
|
9435
8728
|
const kuaishouUtils = {
|
|
9436
8729
|
sign: kuaishouSign,
|
|
9437
|
-
kuaishouApiUrls
|
|
9438
|
-
api: kuaishou
|
|
9439
|
-
};
|
|
9440
|
-
//#endregion
|
|
9441
|
-
//#region src/platform/xiaohongshu/XiaohongshuApi.ts
|
|
9442
|
-
/**
|
|
9443
|
-
* 创建废弃的 API 存根函数
|
|
9444
|
-
*/
|
|
9445
|
-
const createDeprecatedStub = (methodName) => {
|
|
9446
|
-
return (..._args) => {
|
|
9447
|
-
checkDeprecation("getXiaohongshuData");
|
|
9448
|
-
throw new Error(`xiaohongshu.${methodName} 已废弃,请使用 xiaohongshuFetcher 替代`);
|
|
9449
|
-
};
|
|
9450
|
-
};
|
|
9451
|
-
/**
|
|
9452
|
-
* 封装了所有小红书相关的API请求,采用对象化的方式组织。
|
|
9453
|
-
*
|
|
9454
|
-
* @deprecated v6 已废弃,请使用 xiaohongshuFetcher 或 client.xiaohongshu.fetcher 替代
|
|
9455
|
-
*/
|
|
9456
|
-
const xiaohongshu = {
|
|
9457
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchHomeFeed 替代 */
|
|
9458
|
-
getHomeFeed: createDeprecatedStub("getHomeFeed"),
|
|
9459
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteDetail 替代 */
|
|
9460
|
-
getNote: createDeprecatedStub("getNote"),
|
|
9461
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchNoteComments 替代 */
|
|
9462
|
-
getComments: createDeprecatedStub("getComments"),
|
|
9463
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserProfile 替代 */
|
|
9464
|
-
getUser: createDeprecatedStub("getUser"),
|
|
9465
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchUserNoteList 替代 */
|
|
9466
|
-
getUserNotes: createDeprecatedStub("getUserNotes"),
|
|
9467
|
-
/** @deprecated 请使用 xiaohongshuFetcher.searchNotes 替代 */
|
|
9468
|
-
getSearchNotes: createDeprecatedStub("getSearchNotes"),
|
|
9469
|
-
/** @deprecated 请使用 xiaohongshuFetcher.fetchEmojiList 替代 */
|
|
9470
|
-
getEmojiList: createDeprecatedStub("getEmojiList")
|
|
9471
|
-
};
|
|
9472
|
-
/**
|
|
9473
|
-
* 创建绑定了cookie的小红书API对象
|
|
9474
|
-
*
|
|
9475
|
-
* @deprecated v6 已废弃,请使用 createBoundXiaohongshuFetcher 替代
|
|
9476
|
-
*/
|
|
9477
|
-
const createBoundXiaohongshuApi = (_cookie, _requestConfig) => {
|
|
9478
|
-
return { ...xiaohongshu };
|
|
8730
|
+
kuaishouApiUrls
|
|
9479
8731
|
};
|
|
9480
8732
|
//#endregion
|
|
9481
8733
|
//#region src/platform/xiaohongshu/routes.ts
|
|
@@ -9529,8 +8781,7 @@ const createXiaohongshuRoutes = (cookie, requestConfig = getXiaohongshuDefaultCo
|
|
|
9529
8781
|
/** 小红书相关功能模块 (工具集) */
|
|
9530
8782
|
const xiaohongshuUtils = {
|
|
9531
8783
|
sign: xiaohongshuSign,
|
|
9532
|
-
xiaohongshuApiUrls
|
|
9533
|
-
api: xiaohongshu
|
|
8784
|
+
xiaohongshuApiUrls
|
|
9534
8785
|
};
|
|
9535
8786
|
//#endregion
|
|
9536
8787
|
//#region src/server/index.ts
|
|
@@ -9577,38 +8828,6 @@ const createAmagiClient = (options) => {
|
|
|
9577
8828
|
});
|
|
9578
8829
|
return app;
|
|
9579
8830
|
};
|
|
9580
|
-
/**
|
|
9581
|
-
* @deprecated v6 已废弃,请使用 douyin.fetcher 替代
|
|
9582
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9583
|
-
*/
|
|
9584
|
-
const getDouyinData = (..._args) => {
|
|
9585
|
-
checkDeprecation("getDouyinData");
|
|
9586
|
-
throw new Error("getDouyinData 已废弃");
|
|
9587
|
-
};
|
|
9588
|
-
/**
|
|
9589
|
-
* @deprecated v6 已废弃,请使用 bilibili.fetcher 替代
|
|
9590
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9591
|
-
*/
|
|
9592
|
-
const getBilibiliData = (..._args) => {
|
|
9593
|
-
checkDeprecation("getBilibiliData");
|
|
9594
|
-
throw new Error("getBilibiliData 已废弃");
|
|
9595
|
-
};
|
|
9596
|
-
/**
|
|
9597
|
-
* @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代
|
|
9598
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9599
|
-
*/
|
|
9600
|
-
const getKuaishouData = (..._args) => {
|
|
9601
|
-
checkDeprecation("getKuaishouData");
|
|
9602
|
-
throw new Error("getKuaishouData 已废弃");
|
|
9603
|
-
};
|
|
9604
|
-
/**
|
|
9605
|
-
* @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代
|
|
9606
|
-
* @throws {DeprecatedApiError} 调用时抛出废弃错误
|
|
9607
|
-
*/
|
|
9608
|
-
const getXiaohongshuData = (..._args) => {
|
|
9609
|
-
checkDeprecation("getXiaohongshuData");
|
|
9610
|
-
throw new Error("getXiaohongshuData 已废弃");
|
|
9611
|
-
};
|
|
9612
8831
|
return {
|
|
9613
8832
|
/** 启动本地HTTP服务 */
|
|
9614
8833
|
startServer,
|
|
@@ -9626,39 +8845,23 @@ const createAmagiClient = (options) => {
|
|
|
9626
8845
|
* @param listener - 事件处理函数 (只触发一次)
|
|
9627
8846
|
*/
|
|
9628
8847
|
once: (event, listener) => amagiEvents.once(event, listener),
|
|
9629
|
-
/** @deprecated v6 已废弃,请使用 douyin.fetcher 替代 */
|
|
9630
|
-
getDouyinData,
|
|
9631
|
-
/** @deprecated v6 已废弃,请使用 bilibili.fetcher 替代 */
|
|
9632
|
-
getBilibiliData,
|
|
9633
|
-
/** @deprecated v6 已废弃,请使用 kuaishou.fetcher 替代 */
|
|
9634
|
-
getKuaishouData,
|
|
9635
|
-
/** @deprecated v6 已废弃,请使用 xiaohongshu.fetcher 替代 */
|
|
9636
|
-
getXiaohongshuData,
|
|
9637
8848
|
douyin: {
|
|
9638
8849
|
...douyinUtils,
|
|
9639
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9640
|
-
api: createBoundDouyinApi(douyinCookie, requestConfig),
|
|
9641
8850
|
/** fetcher */
|
|
9642
8851
|
fetcher: createBoundDouyinFetcher(douyinCookie, requestConfig)
|
|
9643
8852
|
},
|
|
9644
8853
|
bilibili: {
|
|
9645
8854
|
...bilibiliUtils,
|
|
9646
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9647
|
-
api: createBoundBilibiliApi(bilibiliCookie, requestConfig),
|
|
9648
8855
|
/** fetcher */
|
|
9649
8856
|
fetcher: createBoundBilibiliFetcher(bilibiliCookie, requestConfig)
|
|
9650
8857
|
},
|
|
9651
8858
|
kuaishou: {
|
|
9652
8859
|
...kuaishouUtils,
|
|
9653
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9654
|
-
api: createBoundKuaishouApi(kuaishouCookie, requestConfig),
|
|
9655
8860
|
/** fetcher */
|
|
9656
8861
|
fetcher: createBoundKuaishouFetcher(kuaishouCookie, requestConfig)
|
|
9657
8862
|
},
|
|
9658
8863
|
xiaohongshu: {
|
|
9659
8864
|
...xiaohongshuUtils,
|
|
9660
|
-
/** @deprecated 请使用 fetcher 替代 */
|
|
9661
|
-
api: createBoundXiaohongshuApi(xiaohongshuCookie, requestConfig),
|
|
9662
8865
|
/** fetcher */
|
|
9663
8866
|
fetcher: createBoundXiaohongshuFetcher(xiaohongshuCookie, requestConfig)
|
|
9664
8867
|
}
|
|
@@ -9822,7 +9025,6 @@ const BilibiliInternalMethods = {
|
|
|
9822
9025
|
USER_SPACE_INFO: "用户空间详细信息",
|
|
9823
9026
|
USER_TOTAL_VIEWS: "获取UP主总播放量",
|
|
9824
9027
|
DYNAMIC_DETAIL: "动态详情数据",
|
|
9825
|
-
DYNAMIC_CARD: "动态卡片数据",
|
|
9826
9028
|
BANGUMI_INFO: "番剧基本信息数据",
|
|
9827
9029
|
BANGUMI_STREAM: "番剧下载信息数据",
|
|
9828
9030
|
LIVE_ROOM_INFO: "直播间信息",
|
|
@@ -9853,7 +9055,6 @@ const BilibiliFetcherMethods = {
|
|
|
9853
9055
|
USER_SPACE_INFO: "fetchUserSpaceInfo",
|
|
9854
9056
|
USER_TOTAL_VIEWS: "fetchUploaderTotalViews",
|
|
9855
9057
|
DYNAMIC_DETAIL: "fetchDynamicDetail",
|
|
9856
|
-
DYNAMIC_CARD: "fetchDynamicCard",
|
|
9857
9058
|
BANGUMI_INFO: "fetchBangumiInfo",
|
|
9858
9059
|
BANGUMI_STREAM: "fetchBangumiStreamUrl",
|
|
9859
9060
|
LIVE_ROOM_INFO: "fetchLiveRoomInfo",
|
|
@@ -9962,7 +9163,6 @@ const BilibiliMethodToFetcher = {
|
|
|
9962
9163
|
[BilibiliInternalMethods.USER_SPACE_INFO]: BilibiliFetcherMethods.USER_SPACE_INFO,
|
|
9963
9164
|
[BilibiliInternalMethods.USER_TOTAL_VIEWS]: BilibiliFetcherMethods.USER_TOTAL_VIEWS,
|
|
9964
9165
|
[BilibiliInternalMethods.DYNAMIC_DETAIL]: BilibiliFetcherMethods.DYNAMIC_DETAIL,
|
|
9965
|
-
[BilibiliInternalMethods.DYNAMIC_CARD]: BilibiliFetcherMethods.DYNAMIC_CARD,
|
|
9966
9166
|
[BilibiliInternalMethods.BANGUMI_INFO]: BilibiliFetcherMethods.BANGUMI_INFO,
|
|
9967
9167
|
[BilibiliInternalMethods.BANGUMI_STREAM]: BilibiliFetcherMethods.BANGUMI_STREAM,
|
|
9968
9168
|
[BilibiliInternalMethods.LIVE_ROOM_INFO]: BilibiliFetcherMethods.LIVE_ROOM_INFO,
|
|
@@ -10094,7 +9294,6 @@ const BilibiliMethodMapping = {
|
|
|
10094
9294
|
用户空间详细信息: "fetchUserSpaceInfo",
|
|
10095
9295
|
获取UP主总播放量: "fetchUploaderTotalViews",
|
|
10096
9296
|
动态详情数据: "fetchDynamicDetail",
|
|
10097
|
-
动态卡片数据: "fetchDynamicCard",
|
|
10098
9297
|
番剧基本信息数据: "fetchBangumiInfo",
|
|
10099
9298
|
番剧下载信息数据: "fetchBangumiStreamUrl",
|
|
10100
9299
|
直播间信息: "fetchLiveRoomInfo",
|
|
@@ -10177,7 +9376,6 @@ const BilibiliApiRoutes = {
|
|
|
10177
9376
|
userSpaceInfo: "/user/space",
|
|
10178
9377
|
uploaderTotalViews: "/user/total-views",
|
|
10179
9378
|
dynamicDetail: "/dynamic",
|
|
10180
|
-
dynamicCard: "/dynamic/card",
|
|
10181
9379
|
bangumiInfo: "/bangumi",
|
|
10182
9380
|
bangumiStream: "/bangumi/stream",
|
|
10183
9381
|
liveRoomInfo: "/live",
|
|
@@ -10247,14 +9445,10 @@ function getApiRoute(platform, methodType) {
|
|
|
10247
9445
|
* 构建后使用 __VERSION__,开发环境从 package.json 读取
|
|
10248
9446
|
*/
|
|
10249
9447
|
const getVersion = () => {
|
|
10250
|
-
return "6.
|
|
9448
|
+
return "6.5.0";
|
|
10251
9449
|
};
|
|
10252
9450
|
const VERSION = getVersion();
|
|
10253
9451
|
/**
|
|
10254
|
-
* @deprecated 请使用 createAmagiClient 替代
|
|
10255
|
-
*/
|
|
10256
|
-
const amagiClient = createAmagiClient;
|
|
10257
|
-
/**
|
|
10258
9452
|
* 创建一个新的 amagi 客户端实例
|
|
10259
9453
|
* 用于创建和初始化一个新的 amagi 客户端实例,支持通过 new 关键字或函数调用方式使用
|
|
10260
9454
|
* @param options - cookies 配置选项,用于设置客户端的 cookies 相关参数
|
|
@@ -10274,10 +9468,6 @@ CreateAmagiApp.douyin = douyinUtils;
|
|
|
10274
9468
|
CreateAmagiApp.bilibili = bilibiliUtils;
|
|
10275
9469
|
CreateAmagiApp.kuaishou = kuaishouUtils;
|
|
10276
9470
|
CreateAmagiApp.xiaohongshu = xiaohongshuUtils;
|
|
10277
|
-
CreateAmagiApp.getDouyinData = getDouyinData;
|
|
10278
|
-
CreateAmagiApp.getBilibiliData = getBilibiliData;
|
|
10279
|
-
CreateAmagiApp.getKuaishouData = getKuaishouData;
|
|
10280
|
-
CreateAmagiApp.getXiaohongshuData = getXiaohongshuData;
|
|
10281
9471
|
CreateAmagiApp.events = amagiEvents;
|
|
10282
9472
|
CreateAmagiApp.on = amagiEvents.on.bind(amagiEvents);
|
|
10283
9473
|
CreateAmagiApp.once = amagiEvents.once.bind(amagiEvents);
|
|
@@ -10300,6 +9490,4 @@ const amagi = Client;
|
|
|
10300
9490
|
* GPL-3.0 Licensed
|
|
10301
9491
|
*/
|
|
10302
9492
|
//#endregion
|
|
10303
|
-
export { AdditionalType, ApiError, BilibiliApiRoutes, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDanmakuParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliFetcherMethods, BilibiliInternalMethods, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodMapping, BilibiliMethodRoutes, BilibiliMethodToFetcher, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinApiRoutes, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinFetcherMethods, DouyinHotWordsParamsSchema, DouyinInternalMethods, DouyinLiveRoomParamsSchema, DouyinMethodMapping, DouyinMethodRoutes, DouyinMethodToFetcher, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserListParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouApiRoutes, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouFetcherMethods, KuaishouInternalMethods, KuaishouLiveRoomInfoParamsSchema, KuaishouMethodMapping, KuaishouMethodRoutes, KuaishouMethodToFetcher, KuaishouUserProfileParamsSchema, KuaishouUserWorkListParamsSchema, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, MethodMaps, ValidationError, XiaohongshuApiRoutes, XiaohongshuFetcherMethods, XiaohongshuInternalMethods, XiaohongshuMethodMapping, XiaohongshuMethodRoutes, XiaohongshuMethodToFetcher, XiaohongshuValidationSchemas, amagi,
|
|
10304
|
-
|
|
10305
|
-
//# sourceMappingURL=index.mjs.map
|
|
9493
|
+
export { AdditionalType, ApiError, BilibiliApiRoutes, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDanmakuParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliFetcherMethods, BilibiliInternalMethods, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodMapping, BilibiliMethodRoutes, BilibiliMethodToFetcher, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinApiRoutes, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinFetcherMethods, DouyinHotWordsParamsSchema, DouyinInternalMethods, DouyinLiveRoomParamsSchema, DouyinMethodMapping, DouyinMethodRoutes, DouyinMethodToFetcher, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserListParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouApiRoutes, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouFetcherMethods, KuaishouInternalMethods, KuaishouLiveRoomInfoParamsSchema, KuaishouMethodMapping, KuaishouMethodRoutes, KuaishouMethodToFetcher, KuaishouUserProfileParamsSchema, KuaishouUserWorkListParamsSchema, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, MethodMaps, ValidationError, XiaohongshuApiRoutes, XiaohongshuFetcherMethods, XiaohongshuInternalMethods, XiaohongshuMethodMapping, XiaohongshuMethodRoutes, XiaohongshuMethodToFetcher, XiaohongshuValidationSchemas, amagi, amagiEvents, av2bv, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliFetcher, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliFetcher, createBoundDouyinFetcher, createBoundKuaishouFetcher, createBoundXiaohongshuFetcher, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyinApiUrls, douyinFetcher, douyinSign, douyinUtils, emitApiError, emitApiSuccess, emitHttpRequest, emitHttpResponse, emitLog, emitLogDebug, emitLogError, emitLogInfo, emitLogMark, emitLogWarn, emitNetworkError, emitNetworkRetry, fetchData, fetchResponse, getApiRoute, getEnglishMethodName, getHeadersAndData, handleError, isNetworkErrorResult, kuaishouApiUrls, kuaishouFetcher, kuaishouSign, kuaishouUtils, parseDmSegMobileReply, qtparam, toFetcherMethod, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshuApiUrls, xiaohongshuFetcher, xiaohongshuSign, xiaohongshuUtils };
|