@ikenxuan/amagi 5.11.0 → 5.12.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 +130 -55
- package/dist/default/index.d.cts +559 -76
- package/dist/default/index.d.ts +559 -76
- package/dist/default/index.js +129 -56
- package/package.json +1 -1
package/dist/default/index.cjs
CHANGED
|
@@ -429,7 +429,8 @@ const BilibiliUserParamsSchema = zod.default.object({
|
|
|
429
429
|
methodType: zod.default.enum([
|
|
430
430
|
"用户主页数据",
|
|
431
431
|
"用户主页动态列表数据",
|
|
432
|
-
"获取UP主总播放量"
|
|
432
|
+
"获取UP主总播放量",
|
|
433
|
+
"用户空间详细信息"
|
|
433
434
|
], { error: "方法类型必须是指定的枚举值之一" }),
|
|
434
435
|
host_mid: smartNumber("UP主UID不能为空", 1, true)
|
|
435
436
|
});
|
|
@@ -485,6 +486,19 @@ const BilibiliColumnInfoParamsSchema = zod.default.object({
|
|
|
485
486
|
methodType: zod.default.literal("文集基本信息", { error: "方法类型必须是\"文集基本信息\"" }),
|
|
486
487
|
id: zod.default.string({ error: "文集ID必须是字符串" }).min(1, { error: "文集ID不能为空" })
|
|
487
488
|
});
|
|
489
|
+
const BilibiliApplyCaptchaParamsSchema = zod.default.object({
|
|
490
|
+
methodType: zod.default.literal("从_v_voucher_申请_captcha", { error: "方法类型必须是\"从_v_voucher_申请_captcha\"" }),
|
|
491
|
+
csrf: zod.default.string({ error: "CSRF Token必须是字符串" }).optional(),
|
|
492
|
+
v_voucher: zod.default.string({ error: "验证码ID必须是字符串" }).min(1, { error: "验证码ID不能为空" })
|
|
493
|
+
});
|
|
494
|
+
const BilibiliValidateCaptchaParamsSchema = zod.default.object({
|
|
495
|
+
methodType: zod.default.literal("验证验证码结果", { error: "方法类型必须是\"验证验证码结果\"" }),
|
|
496
|
+
csrf: zod.default.string({ error: "CSRF Token必须是字符串" }).optional(),
|
|
497
|
+
challenge: zod.default.string({ error: "验证码challenge必须是字符串" }).min(1, { error: "验证码challenge不能为空" }),
|
|
498
|
+
token: zod.default.string({ error: "验证码token必须是字符串" }).min(1, { error: "验证码token不能为空" }),
|
|
499
|
+
validate: zod.default.string({ error: "验证码validate必须是字符串" }).min(1, { error: "验证码validate不能为空" }),
|
|
500
|
+
seccode: zod.default.string({ error: "验证码seccode必须是字符串" }).min(1, { error: "验证码seccode不能为空" })
|
|
501
|
+
});
|
|
488
502
|
const BilibiliValidationSchemas = {
|
|
489
503
|
单个视频作品数据: BilibiliVideoParamsSchema,
|
|
490
504
|
单个视频下载信息数据: BilibiliVideoDownloadParamsSchema,
|
|
@@ -492,6 +506,7 @@ const BilibiliValidationSchemas = {
|
|
|
492
506
|
指定评论的回复: BilibiliCommentReplyParamsSchema,
|
|
493
507
|
用户主页数据: BilibiliUserParamsSchema,
|
|
494
508
|
用户主页动态列表数据: BilibiliUserParamsSchema,
|
|
509
|
+
用户空间详细信息: BilibiliUserParamsSchema,
|
|
495
510
|
Emoji数据: BilibiliEmojiParamsSchema,
|
|
496
511
|
番剧基本信息数据: BilibiliBangumiInfoParamsSchema,
|
|
497
512
|
番剧下载信息数据: BilibiliBangumiStreamParamsSchema,
|
|
@@ -508,7 +523,9 @@ const BilibiliValidationSchemas = {
|
|
|
508
523
|
专栏正文内容: BilibiliArticleParamsSchema,
|
|
509
524
|
专栏显示卡片信息: BilibiliArticleCardParamsSchema,
|
|
510
525
|
专栏文章基本信息: BilibiliArticleInfoParamsSchema,
|
|
511
|
-
文集基本信息: BilibiliColumnInfoParamsSchema
|
|
526
|
+
文集基本信息: BilibiliColumnInfoParamsSchema,
|
|
527
|
+
从_v_voucher_申请_captcha: BilibiliApplyCaptchaParamsSchema,
|
|
528
|
+
验证验证码结果: BilibiliValidateCaptchaParamsSchema
|
|
512
529
|
};
|
|
513
530
|
const BilibiliMethodRoutes = {
|
|
514
531
|
单个视频作品数据: "/fetch_one_video",
|
|
@@ -517,6 +534,7 @@ const BilibiliMethodRoutes = {
|
|
|
517
534
|
指定评论的回复: "/fetch_comment_reply",
|
|
518
535
|
用户主页数据: "/fetch_user_profile",
|
|
519
536
|
用户主页动态列表数据: "/fetch_user_dynamic",
|
|
537
|
+
用户空间详细信息: "/fetch_user_space_info",
|
|
520
538
|
Emoji数据: "/fetch_emoji_list",
|
|
521
539
|
番剧基本信息数据: "/fetch_bangumi_video_info",
|
|
522
540
|
番剧下载信息数据: "/fetch_bangumi_video_playurl",
|
|
@@ -533,7 +551,9 @@ const BilibiliMethodRoutes = {
|
|
|
533
551
|
专栏正文内容: "/fetch_article_content",
|
|
534
552
|
专栏显示卡片信息: "/fetch_article_card",
|
|
535
553
|
专栏文章基本信息: "/fetch_article_info",
|
|
536
|
-
文集基本信息: "/fetch_column_info"
|
|
554
|
+
文集基本信息: "/fetch_column_info",
|
|
555
|
+
从_v_voucher_申请_captcha: "/apply_captcha",
|
|
556
|
+
验证验证码结果: "/validate_captcha"
|
|
537
557
|
};
|
|
538
558
|
|
|
539
559
|
//#endregion
|
|
@@ -1093,13 +1113,13 @@ const createSuccessResponse = (data$1, message, code = 200) => {
|
|
|
1093
1113
|
* @param code - 错误状态码(可选,默认500)
|
|
1094
1114
|
* @returns 格式化的错误响应对象
|
|
1095
1115
|
*/
|
|
1096
|
-
const createErrorResponse = (error, message, code = 500) => {
|
|
1116
|
+
const createErrorResponse = (error, message, code = 500, data$1) => {
|
|
1097
1117
|
return {
|
|
1098
1118
|
success: false,
|
|
1099
1119
|
error,
|
|
1100
1120
|
message,
|
|
1101
1121
|
code,
|
|
1102
|
-
data:
|
|
1122
|
+
data: data$1
|
|
1103
1123
|
};
|
|
1104
1124
|
};
|
|
1105
1125
|
|
|
@@ -1233,9 +1253,12 @@ const fetchResponse = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1233
1253
|
* 判断结果是否为网络错误响应
|
|
1234
1254
|
* @param result - 请求结果
|
|
1235
1255
|
* @returns 是否为ErrorResult
|
|
1256
|
+
* @description 通过检查 error 字段中的 amagiError 来区分网络错误和业务错误
|
|
1236
1257
|
*/
|
|
1237
1258
|
const isNetworkErrorResult = (result) => {
|
|
1238
|
-
|
|
1259
|
+
if (result === null || typeof result !== "object") return false;
|
|
1260
|
+
const obj = result;
|
|
1261
|
+
return obj.success === false && obj.error !== null && typeof obj.error === "object" && "amagiError" in obj.error;
|
|
1239
1262
|
};
|
|
1240
1263
|
/**
|
|
1241
1264
|
* 获取响应头和数据(带自动重试)
|
|
@@ -1262,7 +1285,7 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1262
1285
|
const generateSecChUa = (userAgent) => {
|
|
1263
1286
|
const chromeMatch = userAgent.match(/Chrome\/(\d+)/);
|
|
1264
1287
|
const chromeVersion = chromeMatch ? chromeMatch[1] : "125";
|
|
1265
|
-
return `"
|
|
1288
|
+
return `"Not_A Brand";v="99", "Chromium";v="${chromeVersion}", "Google Chrome";v="${chromeVersion}"`;
|
|
1266
1289
|
};
|
|
1267
1290
|
/**
|
|
1268
1291
|
* 抖音平台默认请求配置
|
|
@@ -1277,7 +1300,7 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1277
1300
|
Accept: "application/json, text/plain, */*",
|
|
1278
1301
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
1279
1302
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1280
|
-
Cookie: cookie
|
|
1303
|
+
Cookie: cookie?.trim() ?? "",
|
|
1281
1304
|
Priority: "u=1, i",
|
|
1282
1305
|
Referer: "https://www.douyin.com/",
|
|
1283
1306
|
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
@@ -1305,20 +1328,24 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1305
1328
|
* @returns 合并后的请求配置
|
|
1306
1329
|
*/
|
|
1307
1330
|
const getBilibiliDefaultConfig = (cookie, requestConfig) => {
|
|
1331
|
+
let finalUserAgent = requestConfig?.headers?.["User-Agent"] ?? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36";
|
|
1332
|
+
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
1308
1333
|
const defHeaders = {
|
|
1309
1334
|
Accept: "application/json, text/plain, */*",
|
|
1310
|
-
"Accept-Language": "zh-CN,zh;q=0.9
|
|
1311
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
1312
|
-
|
|
1335
|
+
"Accept-Language": "zh-CN,zh;q=0.9",
|
|
1336
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
1337
|
+
"Cache-Control": "no-cache",
|
|
1338
|
+
Pragma: "no-cache",
|
|
1313
1339
|
Referer: "https://www.bilibili.com/",
|
|
1314
1340
|
Priority: "u=1, i",
|
|
1315
|
-
"Sec-Ch-Ua":
|
|
1341
|
+
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
1316
1342
|
"Sec-Ch-Ua-Mobile": "?0",
|
|
1317
1343
|
"Sec-Ch-Ua-Platform": "\"Windows\"",
|
|
1318
1344
|
"Sec-Fetch-Dest": "empty",
|
|
1319
1345
|
"Sec-Fetch-Mode": "cors",
|
|
1320
1346
|
"Sec-Fetch-Site": "same-site",
|
|
1321
|
-
|
|
1347
|
+
"User-Agent": finalUserAgent,
|
|
1348
|
+
Cookie: cookie?.trim() ?? ""
|
|
1322
1349
|
};
|
|
1323
1350
|
return {
|
|
1324
1351
|
method: "GET",
|
|
@@ -1346,7 +1373,7 @@ const getKuaishouDefaultConfig = (cookie, requestConfig) => {
|
|
|
1346
1373
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1347
1374
|
Priority: "u=0, i",
|
|
1348
1375
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0",
|
|
1349
|
-
Cookie: cookie
|
|
1376
|
+
Cookie: cookie?.trim() ?? ""
|
|
1350
1377
|
};
|
|
1351
1378
|
return {
|
|
1352
1379
|
method: "POST",
|
|
@@ -1428,7 +1455,12 @@ var BiLiBiLiAPI = class {
|
|
|
1428
1455
|
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data$1.cid}&ep_id=${data$1.ep_id}`;
|
|
1429
1456
|
}
|
|
1430
1457
|
用户空间动态(data$1) {
|
|
1431
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space
|
|
1458
|
+
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?${new URLSearchParams({
|
|
1459
|
+
host_mid: data$1.host_mid.toString(),
|
|
1460
|
+
offset: "",
|
|
1461
|
+
platform: "web",
|
|
1462
|
+
features: "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,avatarAutoTheme,sunflowerStyle,eva3CardOpus,eva3CardVideo,eva3CardComment"
|
|
1463
|
+
}).toString()}`;
|
|
1432
1464
|
}
|
|
1433
1465
|
动态详情(data$1) {
|
|
1434
1466
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data$1.dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote,endFooterHidden,decorationCard,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,editable,opusPrivateVisible,avatarAutoTheme`;
|
|
@@ -1466,6 +1498,30 @@ var BiLiBiLiAPI = class {
|
|
|
1466
1498
|
文集基本信息(data$1) {
|
|
1467
1499
|
return `https://api.bilibili.com/x/article/list/web/articles?id=${data$1.id}`;
|
|
1468
1500
|
}
|
|
1501
|
+
用户空间详细信息(data$1) {
|
|
1502
|
+
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data$1.host_mid}`;
|
|
1503
|
+
}
|
|
1504
|
+
从_v_voucher_申请_captcha(data$1) {
|
|
1505
|
+
return {
|
|
1506
|
+
Url: "https://api.bilibili.com/x/gaia-vgate/v1/register",
|
|
1507
|
+
Body: {
|
|
1508
|
+
...data$1.csrf !== void 0 && { csrf: data$1.csrf },
|
|
1509
|
+
v_voucher: data$1.v_voucher
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1513
|
+
验证验证码结果(data$1) {
|
|
1514
|
+
return {
|
|
1515
|
+
Url: "https://api.bilibili.com/x/gaia-vgate/v1/validate",
|
|
1516
|
+
Body: {
|
|
1517
|
+
challenge: data$1.challenge,
|
|
1518
|
+
token: data$1.token,
|
|
1519
|
+
validate: data$1.validate,
|
|
1520
|
+
seccode: data$1.seccode,
|
|
1521
|
+
...data$1.csrf !== void 0 && { csrf: data$1.csrf }
|
|
1522
|
+
}
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1469
1525
|
};
|
|
1470
1526
|
/** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
|
|
1471
1527
|
const bilibiliApiUrls = new BiLiBiLiAPI();
|
|
@@ -1527,7 +1583,10 @@ const bilibili = {
|
|
|
1527
1583
|
getArticleContent: createBilibiliApiMethod("专栏正文内容"),
|
|
1528
1584
|
getArticleCard: createBilibiliApiMethod("专栏显示卡片信息"),
|
|
1529
1585
|
getArticleInfo: createBilibiliApiMethod("专栏文章基本信息"),
|
|
1530
|
-
getColumnInfo: createBilibiliApiMethod("文集基本信息")
|
|
1586
|
+
getColumnInfo: createBilibiliApiMethod("文集基本信息"),
|
|
1587
|
+
getUserProfileDetail: createBilibiliApiMethod("用户空间详细信息"),
|
|
1588
|
+
applyVoucherCaptcha: createBilibiliApiMethod("从_v_voucher_申请_captcha"),
|
|
1589
|
+
validateCaptcha: createBilibiliApiMethod("验证验证码结果")
|
|
1531
1590
|
};
|
|
1532
1591
|
/**
|
|
1533
1592
|
* 创建绑定了cookie的B站API对象
|
|
@@ -1558,7 +1617,10 @@ const createBoundBilibiliApi = (cookie, requestConfig) => {
|
|
|
1558
1617
|
getArticleContent: createBoundBilibiliApiMethod("专栏正文内容", cookie),
|
|
1559
1618
|
getArticleCard: createBoundBilibiliApiMethod("专栏显示卡片信息", cookie),
|
|
1560
1619
|
getArticleInfo: createBoundBilibiliApiMethod("专栏文章基本信息", cookie),
|
|
1561
|
-
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie)
|
|
1620
|
+
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie),
|
|
1621
|
+
getUserProfileDetail: createBoundBilibiliApiMethod("用户空间详细信息", cookie),
|
|
1622
|
+
applyVoucherCaptcha: createBoundBilibiliApiMethod("从_v_voucher_申请_captcha", cookie),
|
|
1623
|
+
validateCaptcha: createBoundBilibiliApiMethod("验证验证码结果", cookie)
|
|
1562
1624
|
};
|
|
1563
1625
|
};
|
|
1564
1626
|
|
|
@@ -1979,17 +2041,7 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
1979
2041
|
* @returns 返回B站数据
|
|
1980
2042
|
*/
|
|
1981
2043
|
const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
1982
|
-
const
|
|
1983
|
-
const baseRequestConfig = {
|
|
1984
|
-
method: "GET",
|
|
1985
|
-
timeout: 1e4,
|
|
1986
|
-
...requestConfig,
|
|
1987
|
-
headers: {
|
|
1988
|
-
Referer: "https://www.bilibili.com/",
|
|
1989
|
-
...defHeaders,
|
|
1990
|
-
...requestConfig?.headers ?? {}
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
2044
|
+
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
1993
2045
|
switch (data$1.methodType) {
|
|
1994
2046
|
case "单个视频作品数据": return await GlobalGetData$3(data$1.methodType, {
|
|
1995
2047
|
...baseRequestConfig,
|
|
@@ -2103,44 +2155,41 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2103
2155
|
}
|
|
2104
2156
|
case "用户主页动态列表数据": {
|
|
2105
2157
|
const { host_mid } = data$1;
|
|
2106
|
-
const
|
|
2107
|
-
|
|
2108
|
-
headers
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
Origin: "https://space.bilibili.com"
|
|
2112
|
-
}
|
|
2158
|
+
const hasExternalReferer = requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers);
|
|
2159
|
+
const customHeaders = {
|
|
2160
|
+
...baseRequestConfig.headers,
|
|
2161
|
+
Origin: "https://space.bilibili.com",
|
|
2162
|
+
...!hasExternalReferer && { Referer: `https://space.bilibili.com/${host_mid}/dynamic` }
|
|
2113
2163
|
};
|
|
2114
2164
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2115
2165
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2116
|
-
...
|
|
2166
|
+
...baseRequestConfig,
|
|
2167
|
+
headers: customHeaders,
|
|
2117
2168
|
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2118
2169
|
});
|
|
2119
2170
|
}
|
|
2120
2171
|
case "动态详情数据": {
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2123
|
-
headers
|
|
2124
|
-
|
|
2125
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2126
|
-
}
|
|
2172
|
+
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
2173
|
+
const customHeaders = {
|
|
2174
|
+
...baseRequestConfig.headers,
|
|
2175
|
+
...!hasExternalReferer && { Referer: void 0 }
|
|
2127
2176
|
};
|
|
2128
2177
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2129
|
-
...
|
|
2178
|
+
...baseRequestConfig,
|
|
2179
|
+
headers: customHeaders,
|
|
2130
2180
|
url: bilibiliApiUrls.动态详情({ dynamic_id: data$1.dynamic_id })
|
|
2131
2181
|
});
|
|
2132
2182
|
}
|
|
2133
2183
|
case "动态卡片数据": {
|
|
2134
|
-
const customConfig = {
|
|
2135
|
-
...baseRequestConfig,
|
|
2136
|
-
headers: {
|
|
2137
|
-
...baseRequestConfig.headers,
|
|
2138
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2139
|
-
}
|
|
2140
|
-
};
|
|
2141
2184
|
const { dynamic_id } = data$1;
|
|
2185
|
+
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
2186
|
+
const customHeaders = {
|
|
2187
|
+
...baseRequestConfig.headers,
|
|
2188
|
+
...!hasExternalReferer && { Referer: void 0 }
|
|
2189
|
+
};
|
|
2142
2190
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2143
|
-
...
|
|
2191
|
+
...baseRequestConfig,
|
|
2192
|
+
headers: customHeaders,
|
|
2144
2193
|
url: bilibiliApiUrls.动态卡片信息({ dynamic_id })
|
|
2145
2194
|
});
|
|
2146
2195
|
}
|
|
@@ -2151,6 +2200,13 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2151
2200
|
url: bilibiliApiUrls.用户名片信息({ host_mid })
|
|
2152
2201
|
});
|
|
2153
2202
|
}
|
|
2203
|
+
case "用户空间详细信息": {
|
|
2204
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间详细信息({ host_mid: data$1.host_mid }), baseRequestConfig.headers?.cookie);
|
|
2205
|
+
return await GlobalGetData$3(data$1.methodType, {
|
|
2206
|
+
...baseRequestConfig,
|
|
2207
|
+
url: bilibiliApiUrls.用户空间详细信息({ host_mid: data$1.host_mid }) + wbiSignQuery
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2154
2210
|
case "直播间信息": return await GlobalGetData$3(data$1.methodType, {
|
|
2155
2211
|
...baseRequestConfig,
|
|
2156
2212
|
url: bilibiliApiUrls.直播间信息({ room_id: data$1.room_id })
|
|
@@ -2246,6 +2302,18 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2246
2302
|
...baseRequestConfig,
|
|
2247
2303
|
url: bilibiliApiUrls.文集基本信息({ id: data$1.id })
|
|
2248
2304
|
});
|
|
2305
|
+
case "从_v_voucher_申请_captcha": return await GlobalGetData$3(data$1.methodType, {
|
|
2306
|
+
...baseRequestConfig,
|
|
2307
|
+
method: "POST",
|
|
2308
|
+
url: bilibiliApiUrls.从_v_voucher_申请_captcha(data$1).Url,
|
|
2309
|
+
data: bilibiliApiUrls.从_v_voucher_申请_captcha(data$1).Body
|
|
2310
|
+
});
|
|
2311
|
+
case "验证验证码结果": return await GlobalGetData$3(data$1.methodType, {
|
|
2312
|
+
...baseRequestConfig,
|
|
2313
|
+
method: "POST",
|
|
2314
|
+
url: bilibiliApiUrls.验证验证码结果(data$1).Url,
|
|
2315
|
+
data: bilibiliApiUrls.验证验证码结果(data$1).Body
|
|
2316
|
+
});
|
|
2249
2317
|
default:
|
|
2250
2318
|
logger.warn(`未知的B站数据接口:「${logger.red(data$1.methodType)}」`);
|
|
2251
2319
|
return null;
|
|
@@ -2387,7 +2455,9 @@ const bilibiliErrorCodeMap = {
|
|
|
2387
2455
|
"-689": "版权限制",
|
|
2388
2456
|
"-701": "扣节操失败",
|
|
2389
2457
|
"-799": "请求过于频繁,请稍后再试",
|
|
2390
|
-
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)"
|
|
2458
|
+
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)",
|
|
2459
|
+
1e5: "验证码获取失败",
|
|
2460
|
+
100003: "验证码过期"
|
|
2391
2461
|
};
|
|
2392
2462
|
|
|
2393
2463
|
//#endregion
|
|
@@ -4483,16 +4553,19 @@ async function getBilibiliData(methodType, optionsOrCookie, cookieOrOptions, req
|
|
|
4483
4553
|
try {
|
|
4484
4554
|
let options;
|
|
4485
4555
|
let cookie;
|
|
4556
|
+
let config;
|
|
4486
4557
|
if (typeof optionsOrCookie === "string") {
|
|
4487
4558
|
cookie = optionsOrCookie;
|
|
4488
4559
|
options = cookieOrOptions;
|
|
4560
|
+
config = requestConfig;
|
|
4489
4561
|
} else {
|
|
4490
4562
|
options = optionsOrCookie;
|
|
4491
4563
|
cookie = cookieOrOptions;
|
|
4564
|
+
config = requestConfig;
|
|
4492
4565
|
}
|
|
4493
4566
|
const { typeMode: _, ...validationOptions } = options ?? {};
|
|
4494
|
-
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, validationOptions) }, cookie);
|
|
4495
|
-
if (rawData.code !== 0) return createErrorResponse(rawData.amagiError, "B站数据获取失败");
|
|
4567
|
+
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, validationOptions) }, cookie, config);
|
|
4568
|
+
if (rawData.code !== 0) return createErrorResponse(rawData.amagiError, "B站数据获取失败", rawData.code, rawData.data);
|
|
4496
4569
|
return createSuccessResponse(rawData, "获取成功", 200);
|
|
4497
4570
|
} catch (error) {
|
|
4498
4571
|
const errorMessage = error instanceof Error ? error.message : "未知错误";
|
|
@@ -5110,7 +5183,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
5110
5183
|
|
|
5111
5184
|
//#endregion
|
|
5112
5185
|
//#region src/index.ts
|
|
5113
|
-
const VERSION = "5.
|
|
5186
|
+
const VERSION = "5.12.0";
|
|
5114
5187
|
/**
|
|
5115
5188
|
* @deprecated 请使用 createAmagiClient 替代
|
|
5116
5189
|
*/
|
|
@@ -5148,6 +5221,7 @@ const amagi = Client;
|
|
|
5148
5221
|
//#endregion
|
|
5149
5222
|
exports.AdditionalType = AdditionalType;
|
|
5150
5223
|
exports.ApiError = ApiError;
|
|
5224
|
+
exports.BilibiliApplyCaptchaParamsSchema = BilibiliApplyCaptchaParamsSchema;
|
|
5151
5225
|
exports.BilibiliArticleCardParamsSchema = BilibiliArticleCardParamsSchema;
|
|
5152
5226
|
exports.BilibiliArticleInfoParamsSchema = BilibiliArticleInfoParamsSchema;
|
|
5153
5227
|
exports.BilibiliArticleParamsSchema = BilibiliArticleParamsSchema;
|
|
@@ -5166,6 +5240,7 @@ exports.BilibiliMethodRoutes = BilibiliMethodRoutes;
|
|
|
5166
5240
|
exports.BilibiliQrcodeParamsSchema = BilibiliQrcodeParamsSchema;
|
|
5167
5241
|
exports.BilibiliQrcodeStatusParamsSchema = BilibiliQrcodeStatusParamsSchema;
|
|
5168
5242
|
exports.BilibiliUserParamsSchema = BilibiliUserParamsSchema;
|
|
5243
|
+
exports.BilibiliValidateCaptchaParamsSchema = BilibiliValidateCaptchaParamsSchema;
|
|
5169
5244
|
exports.BilibiliValidationSchemas = BilibiliValidationSchemas;
|
|
5170
5245
|
exports.BilibiliVideoDownloadParamsSchema = BilibiliVideoDownloadParamsSchema;
|
|
5171
5246
|
exports.BilibiliVideoParamsSchema = BilibiliVideoParamsSchema;
|