@ikenxuan/amagi 5.11.1 → 5.12.1
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 +126 -54
- package/dist/default/index.d.cts +626 -144
- package/dist/default/index.d.ts +626 -144
- package/dist/default/index.js +125 -55
- package/package.json +2 -2
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
|
|
|
@@ -1265,7 +1285,7 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1265
1285
|
const generateSecChUa = (userAgent) => {
|
|
1266
1286
|
const chromeMatch = userAgent.match(/Chrome\/(\d+)/);
|
|
1267
1287
|
const chromeVersion = chromeMatch ? chromeMatch[1] : "125";
|
|
1268
|
-
return `"
|
|
1288
|
+
return `"Not_A Brand";v="99", "Chromium";v="${chromeVersion}", "Google Chrome";v="${chromeVersion}"`;
|
|
1269
1289
|
};
|
|
1270
1290
|
/**
|
|
1271
1291
|
* 抖音平台默认请求配置
|
|
@@ -1280,7 +1300,7 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1280
1300
|
Accept: "application/json, text/plain, */*",
|
|
1281
1301
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
1282
1302
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1283
|
-
Cookie: cookie
|
|
1303
|
+
Cookie: cookie?.trim() ?? "",
|
|
1284
1304
|
Priority: "u=1, i",
|
|
1285
1305
|
Referer: "https://www.douyin.com/",
|
|
1286
1306
|
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
@@ -1308,20 +1328,24 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1308
1328
|
* @returns 合并后的请求配置
|
|
1309
1329
|
*/
|
|
1310
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, "");
|
|
1311
1333
|
const defHeaders = {
|
|
1312
1334
|
Accept: "application/json, text/plain, */*",
|
|
1313
|
-
"Accept-Language": "zh-CN,zh;q=0.9
|
|
1314
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
1315
|
-
|
|
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",
|
|
1316
1339
|
Referer: "https://www.bilibili.com/",
|
|
1317
1340
|
Priority: "u=1, i",
|
|
1318
|
-
"Sec-Ch-Ua":
|
|
1341
|
+
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
1319
1342
|
"Sec-Ch-Ua-Mobile": "?0",
|
|
1320
1343
|
"Sec-Ch-Ua-Platform": "\"Windows\"",
|
|
1321
1344
|
"Sec-Fetch-Dest": "empty",
|
|
1322
1345
|
"Sec-Fetch-Mode": "cors",
|
|
1323
1346
|
"Sec-Fetch-Site": "same-site",
|
|
1324
|
-
|
|
1347
|
+
"User-Agent": finalUserAgent,
|
|
1348
|
+
Cookie: cookie?.trim() ?? ""
|
|
1325
1349
|
};
|
|
1326
1350
|
return {
|
|
1327
1351
|
method: "GET",
|
|
@@ -1349,7 +1373,7 @@ const getKuaishouDefaultConfig = (cookie, requestConfig) => {
|
|
|
1349
1373
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1350
1374
|
Priority: "u=0, i",
|
|
1351
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",
|
|
1352
|
-
Cookie: cookie
|
|
1376
|
+
Cookie: cookie?.trim() ?? ""
|
|
1353
1377
|
};
|
|
1354
1378
|
return {
|
|
1355
1379
|
method: "POST",
|
|
@@ -1431,7 +1455,12 @@ var BiLiBiLiAPI = class {
|
|
|
1431
1455
|
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data$1.cid}&ep_id=${data$1.ep_id}`;
|
|
1432
1456
|
}
|
|
1433
1457
|
用户空间动态(data$1) {
|
|
1434
|
-
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()}`;
|
|
1435
1464
|
}
|
|
1436
1465
|
动态详情(data$1) {
|
|
1437
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`;
|
|
@@ -1469,6 +1498,30 @@ var BiLiBiLiAPI = class {
|
|
|
1469
1498
|
文集基本信息(data$1) {
|
|
1470
1499
|
return `https://api.bilibili.com/x/article/list/web/articles?id=${data$1.id}`;
|
|
1471
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
|
+
}
|
|
1472
1525
|
};
|
|
1473
1526
|
/** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
|
|
1474
1527
|
const bilibiliApiUrls = new BiLiBiLiAPI();
|
|
@@ -1530,7 +1583,10 @@ const bilibili = {
|
|
|
1530
1583
|
getArticleContent: createBilibiliApiMethod("专栏正文内容"),
|
|
1531
1584
|
getArticleCard: createBilibiliApiMethod("专栏显示卡片信息"),
|
|
1532
1585
|
getArticleInfo: createBilibiliApiMethod("专栏文章基本信息"),
|
|
1533
|
-
getColumnInfo: createBilibiliApiMethod("文集基本信息")
|
|
1586
|
+
getColumnInfo: createBilibiliApiMethod("文集基本信息"),
|
|
1587
|
+
getUserProfileDetail: createBilibiliApiMethod("用户空间详细信息"),
|
|
1588
|
+
applyVoucherCaptcha: createBilibiliApiMethod("从_v_voucher_申请_captcha"),
|
|
1589
|
+
validateCaptcha: createBilibiliApiMethod("验证验证码结果")
|
|
1534
1590
|
};
|
|
1535
1591
|
/**
|
|
1536
1592
|
* 创建绑定了cookie的B站API对象
|
|
@@ -1561,7 +1617,10 @@ const createBoundBilibiliApi = (cookie, requestConfig) => {
|
|
|
1561
1617
|
getArticleContent: createBoundBilibiliApiMethod("专栏正文内容", cookie),
|
|
1562
1618
|
getArticleCard: createBoundBilibiliApiMethod("专栏显示卡片信息", cookie),
|
|
1563
1619
|
getArticleInfo: createBoundBilibiliApiMethod("专栏文章基本信息", cookie),
|
|
1564
|
-
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie)
|
|
1620
|
+
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie),
|
|
1621
|
+
getUserProfileDetail: createBoundBilibiliApiMethod("用户空间详细信息", cookie),
|
|
1622
|
+
applyVoucherCaptcha: createBoundBilibiliApiMethod("从_v_voucher_申请_captcha", cookie),
|
|
1623
|
+
validateCaptcha: createBoundBilibiliApiMethod("验证验证码结果", cookie)
|
|
1565
1624
|
};
|
|
1566
1625
|
};
|
|
1567
1626
|
|
|
@@ -1982,17 +2041,7 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
1982
2041
|
* @returns 返回B站数据
|
|
1983
2042
|
*/
|
|
1984
2043
|
const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
1985
|
-
const
|
|
1986
|
-
const baseRequestConfig = {
|
|
1987
|
-
method: "GET",
|
|
1988
|
-
timeout: 1e4,
|
|
1989
|
-
...requestConfig,
|
|
1990
|
-
headers: {
|
|
1991
|
-
Referer: "https://www.bilibili.com/",
|
|
1992
|
-
...defHeaders,
|
|
1993
|
-
...requestConfig?.headers ?? {}
|
|
1994
|
-
}
|
|
1995
|
-
};
|
|
2044
|
+
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
1996
2045
|
switch (data$1.methodType) {
|
|
1997
2046
|
case "单个视频作品数据": return await GlobalGetData$3(data$1.methodType, {
|
|
1998
2047
|
...baseRequestConfig,
|
|
@@ -2106,44 +2155,41 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2106
2155
|
}
|
|
2107
2156
|
case "用户主页动态列表数据": {
|
|
2108
2157
|
const { host_mid } = data$1;
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2111
|
-
headers
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
Origin: "https://space.bilibili.com"
|
|
2115
|
-
}
|
|
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` }
|
|
2116
2163
|
};
|
|
2117
2164
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2118
2165
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2119
|
-
...
|
|
2166
|
+
...baseRequestConfig,
|
|
2167
|
+
headers: customHeaders,
|
|
2120
2168
|
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2121
2169
|
});
|
|
2122
2170
|
}
|
|
2123
2171
|
case "动态详情数据": {
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
headers
|
|
2127
|
-
|
|
2128
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2129
|
-
}
|
|
2172
|
+
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
2173
|
+
const customHeaders = {
|
|
2174
|
+
...baseRequestConfig.headers,
|
|
2175
|
+
...!hasExternalReferer && { Referer: void 0 }
|
|
2130
2176
|
};
|
|
2131
2177
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2132
|
-
...
|
|
2178
|
+
...baseRequestConfig,
|
|
2179
|
+
headers: customHeaders,
|
|
2133
2180
|
url: bilibiliApiUrls.动态详情({ dynamic_id: data$1.dynamic_id })
|
|
2134
2181
|
});
|
|
2135
2182
|
}
|
|
2136
2183
|
case "动态卡片数据": {
|
|
2137
|
-
const customConfig = {
|
|
2138
|
-
...baseRequestConfig,
|
|
2139
|
-
headers: {
|
|
2140
|
-
...baseRequestConfig.headers,
|
|
2141
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2142
|
-
}
|
|
2143
|
-
};
|
|
2144
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
|
+
};
|
|
2145
2190
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2146
|
-
...
|
|
2191
|
+
...baseRequestConfig,
|
|
2192
|
+
headers: customHeaders,
|
|
2147
2193
|
url: bilibiliApiUrls.动态卡片信息({ dynamic_id })
|
|
2148
2194
|
});
|
|
2149
2195
|
}
|
|
@@ -2154,6 +2200,13 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2154
2200
|
url: bilibiliApiUrls.用户名片信息({ host_mid })
|
|
2155
2201
|
});
|
|
2156
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
|
+
}
|
|
2157
2210
|
case "直播间信息": return await GlobalGetData$3(data$1.methodType, {
|
|
2158
2211
|
...baseRequestConfig,
|
|
2159
2212
|
url: bilibiliApiUrls.直播间信息({ room_id: data$1.room_id })
|
|
@@ -2249,6 +2302,18 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2249
2302
|
...baseRequestConfig,
|
|
2250
2303
|
url: bilibiliApiUrls.文集基本信息({ id: data$1.id })
|
|
2251
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
|
+
});
|
|
2252
2317
|
default:
|
|
2253
2318
|
logger.warn(`未知的B站数据接口:「${logger.red(data$1.methodType)}」`);
|
|
2254
2319
|
return null;
|
|
@@ -2390,7 +2455,9 @@ const bilibiliErrorCodeMap = {
|
|
|
2390
2455
|
"-689": "版权限制",
|
|
2391
2456
|
"-701": "扣节操失败",
|
|
2392
2457
|
"-799": "请求过于频繁,请稍后再试",
|
|
2393
|
-
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)"
|
|
2458
|
+
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)",
|
|
2459
|
+
1e5: "验证码获取失败",
|
|
2460
|
+
100003: "验证码过期"
|
|
2394
2461
|
};
|
|
2395
2462
|
|
|
2396
2463
|
//#endregion
|
|
@@ -4486,16 +4553,19 @@ async function getBilibiliData(methodType, optionsOrCookie, cookieOrOptions, req
|
|
|
4486
4553
|
try {
|
|
4487
4554
|
let options;
|
|
4488
4555
|
let cookie;
|
|
4556
|
+
let config;
|
|
4489
4557
|
if (typeof optionsOrCookie === "string") {
|
|
4490
4558
|
cookie = optionsOrCookie;
|
|
4491
4559
|
options = cookieOrOptions;
|
|
4560
|
+
config = requestConfig;
|
|
4492
4561
|
} else {
|
|
4493
4562
|
options = optionsOrCookie;
|
|
4494
4563
|
cookie = cookieOrOptions;
|
|
4564
|
+
config = requestConfig;
|
|
4495
4565
|
}
|
|
4496
4566
|
const { typeMode: _, ...validationOptions } = options ?? {};
|
|
4497
|
-
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, validationOptions) }, cookie);
|
|
4498
|
-
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);
|
|
4499
4569
|
return createSuccessResponse(rawData, "获取成功", 200);
|
|
4500
4570
|
} catch (error) {
|
|
4501
4571
|
const errorMessage = error instanceof Error ? error.message : "未知错误";
|
|
@@ -5113,7 +5183,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
5113
5183
|
|
|
5114
5184
|
//#endregion
|
|
5115
5185
|
//#region src/index.ts
|
|
5116
|
-
const VERSION = "5.
|
|
5186
|
+
const VERSION = "5.12.1";
|
|
5117
5187
|
/**
|
|
5118
5188
|
* @deprecated 请使用 createAmagiClient 替代
|
|
5119
5189
|
*/
|
|
@@ -5151,6 +5221,7 @@ const amagi = Client;
|
|
|
5151
5221
|
//#endregion
|
|
5152
5222
|
exports.AdditionalType = AdditionalType;
|
|
5153
5223
|
exports.ApiError = ApiError;
|
|
5224
|
+
exports.BilibiliApplyCaptchaParamsSchema = BilibiliApplyCaptchaParamsSchema;
|
|
5154
5225
|
exports.BilibiliArticleCardParamsSchema = BilibiliArticleCardParamsSchema;
|
|
5155
5226
|
exports.BilibiliArticleInfoParamsSchema = BilibiliArticleInfoParamsSchema;
|
|
5156
5227
|
exports.BilibiliArticleParamsSchema = BilibiliArticleParamsSchema;
|
|
@@ -5169,6 +5240,7 @@ exports.BilibiliMethodRoutes = BilibiliMethodRoutes;
|
|
|
5169
5240
|
exports.BilibiliQrcodeParamsSchema = BilibiliQrcodeParamsSchema;
|
|
5170
5241
|
exports.BilibiliQrcodeStatusParamsSchema = BilibiliQrcodeStatusParamsSchema;
|
|
5171
5242
|
exports.BilibiliUserParamsSchema = BilibiliUserParamsSchema;
|
|
5243
|
+
exports.BilibiliValidateCaptchaParamsSchema = BilibiliValidateCaptchaParamsSchema;
|
|
5172
5244
|
exports.BilibiliValidationSchemas = BilibiliValidationSchemas;
|
|
5173
5245
|
exports.BilibiliVideoDownloadParamsSchema = BilibiliVideoDownloadParamsSchema;
|
|
5174
5246
|
exports.BilibiliVideoParamsSchema = BilibiliVideoParamsSchema;
|