@ikenxuan/amagi 5.11.1 → 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 +126 -54
- package/dist/default/index.d.cts +558 -76
- package/dist/default/index.d.ts +558 -76
- package/dist/default/index.js +125 -55
- package/package.json +1 -1
package/dist/default/index.js
CHANGED
|
@@ -419,7 +419,8 @@ const BilibiliUserParamsSchema = zod.object({
|
|
|
419
419
|
methodType: zod.enum([
|
|
420
420
|
"用户主页数据",
|
|
421
421
|
"用户主页动态列表数据",
|
|
422
|
-
"获取UP主总播放量"
|
|
422
|
+
"获取UP主总播放量",
|
|
423
|
+
"用户空间详细信息"
|
|
423
424
|
], { error: "方法类型必须是指定的枚举值之一" }),
|
|
424
425
|
host_mid: smartNumber("UP主UID不能为空", 1, true)
|
|
425
426
|
});
|
|
@@ -475,6 +476,19 @@ const BilibiliColumnInfoParamsSchema = zod.object({
|
|
|
475
476
|
methodType: zod.literal("文集基本信息", { error: "方法类型必须是\"文集基本信息\"" }),
|
|
476
477
|
id: zod.string({ error: "文集ID必须是字符串" }).min(1, { error: "文集ID不能为空" })
|
|
477
478
|
});
|
|
479
|
+
const BilibiliApplyCaptchaParamsSchema = zod.object({
|
|
480
|
+
methodType: zod.literal("从_v_voucher_申请_captcha", { error: "方法类型必须是\"从_v_voucher_申请_captcha\"" }),
|
|
481
|
+
csrf: zod.string({ error: "CSRF Token必须是字符串" }).optional(),
|
|
482
|
+
v_voucher: zod.string({ error: "验证码ID必须是字符串" }).min(1, { error: "验证码ID不能为空" })
|
|
483
|
+
});
|
|
484
|
+
const BilibiliValidateCaptchaParamsSchema = zod.object({
|
|
485
|
+
methodType: zod.literal("验证验证码结果", { error: "方法类型必须是\"验证验证码结果\"" }),
|
|
486
|
+
csrf: zod.string({ error: "CSRF Token必须是字符串" }).optional(),
|
|
487
|
+
challenge: zod.string({ error: "验证码challenge必须是字符串" }).min(1, { error: "验证码challenge不能为空" }),
|
|
488
|
+
token: zod.string({ error: "验证码token必须是字符串" }).min(1, { error: "验证码token不能为空" }),
|
|
489
|
+
validate: zod.string({ error: "验证码validate必须是字符串" }).min(1, { error: "验证码validate不能为空" }),
|
|
490
|
+
seccode: zod.string({ error: "验证码seccode必须是字符串" }).min(1, { error: "验证码seccode不能为空" })
|
|
491
|
+
});
|
|
478
492
|
const BilibiliValidationSchemas = {
|
|
479
493
|
单个视频作品数据: BilibiliVideoParamsSchema,
|
|
480
494
|
单个视频下载信息数据: BilibiliVideoDownloadParamsSchema,
|
|
@@ -482,6 +496,7 @@ const BilibiliValidationSchemas = {
|
|
|
482
496
|
指定评论的回复: BilibiliCommentReplyParamsSchema,
|
|
483
497
|
用户主页数据: BilibiliUserParamsSchema,
|
|
484
498
|
用户主页动态列表数据: BilibiliUserParamsSchema,
|
|
499
|
+
用户空间详细信息: BilibiliUserParamsSchema,
|
|
485
500
|
Emoji数据: BilibiliEmojiParamsSchema,
|
|
486
501
|
番剧基本信息数据: BilibiliBangumiInfoParamsSchema,
|
|
487
502
|
番剧下载信息数据: BilibiliBangumiStreamParamsSchema,
|
|
@@ -498,7 +513,9 @@ const BilibiliValidationSchemas = {
|
|
|
498
513
|
专栏正文内容: BilibiliArticleParamsSchema,
|
|
499
514
|
专栏显示卡片信息: BilibiliArticleCardParamsSchema,
|
|
500
515
|
专栏文章基本信息: BilibiliArticleInfoParamsSchema,
|
|
501
|
-
文集基本信息: BilibiliColumnInfoParamsSchema
|
|
516
|
+
文集基本信息: BilibiliColumnInfoParamsSchema,
|
|
517
|
+
从_v_voucher_申请_captcha: BilibiliApplyCaptchaParamsSchema,
|
|
518
|
+
验证验证码结果: BilibiliValidateCaptchaParamsSchema
|
|
502
519
|
};
|
|
503
520
|
const BilibiliMethodRoutes = {
|
|
504
521
|
单个视频作品数据: "/fetch_one_video",
|
|
@@ -507,6 +524,7 @@ const BilibiliMethodRoutes = {
|
|
|
507
524
|
指定评论的回复: "/fetch_comment_reply",
|
|
508
525
|
用户主页数据: "/fetch_user_profile",
|
|
509
526
|
用户主页动态列表数据: "/fetch_user_dynamic",
|
|
527
|
+
用户空间详细信息: "/fetch_user_space_info",
|
|
510
528
|
Emoji数据: "/fetch_emoji_list",
|
|
511
529
|
番剧基本信息数据: "/fetch_bangumi_video_info",
|
|
512
530
|
番剧下载信息数据: "/fetch_bangumi_video_playurl",
|
|
@@ -523,7 +541,9 @@ const BilibiliMethodRoutes = {
|
|
|
523
541
|
专栏正文内容: "/fetch_article_content",
|
|
524
542
|
专栏显示卡片信息: "/fetch_article_card",
|
|
525
543
|
专栏文章基本信息: "/fetch_article_info",
|
|
526
|
-
文集基本信息: "/fetch_column_info"
|
|
544
|
+
文集基本信息: "/fetch_column_info",
|
|
545
|
+
从_v_voucher_申请_captcha: "/apply_captcha",
|
|
546
|
+
验证验证码结果: "/validate_captcha"
|
|
527
547
|
};
|
|
528
548
|
|
|
529
549
|
//#endregion
|
|
@@ -1083,13 +1103,13 @@ const createSuccessResponse = (data$1, message, code = 200) => {
|
|
|
1083
1103
|
* @param code - 错误状态码(可选,默认500)
|
|
1084
1104
|
* @returns 格式化的错误响应对象
|
|
1085
1105
|
*/
|
|
1086
|
-
const createErrorResponse = (error, message, code = 500) => {
|
|
1106
|
+
const createErrorResponse = (error, message, code = 500, data$1) => {
|
|
1087
1107
|
return {
|
|
1088
1108
|
success: false,
|
|
1089
1109
|
error,
|
|
1090
1110
|
message,
|
|
1091
1111
|
code,
|
|
1092
|
-
data:
|
|
1112
|
+
data: data$1
|
|
1093
1113
|
};
|
|
1094
1114
|
};
|
|
1095
1115
|
|
|
@@ -1255,7 +1275,7 @@ const getHeadersAndData = async (config, maxRetries = DEFAULT_MAX_RETRIES) => {
|
|
|
1255
1275
|
const generateSecChUa = (userAgent) => {
|
|
1256
1276
|
const chromeMatch = userAgent.match(/Chrome\/(\d+)/);
|
|
1257
1277
|
const chromeVersion = chromeMatch ? chromeMatch[1] : "125";
|
|
1258
|
-
return `"
|
|
1278
|
+
return `"Not_A Brand";v="99", "Chromium";v="${chromeVersion}", "Google Chrome";v="${chromeVersion}"`;
|
|
1259
1279
|
};
|
|
1260
1280
|
/**
|
|
1261
1281
|
* 抖音平台默认请求配置
|
|
@@ -1270,7 +1290,7 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1270
1290
|
Accept: "application/json, text/plain, */*",
|
|
1271
1291
|
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
1272
1292
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1273
|
-
Cookie: cookie
|
|
1293
|
+
Cookie: cookie?.trim() ?? "",
|
|
1274
1294
|
Priority: "u=1, i",
|
|
1275
1295
|
Referer: "https://www.douyin.com/",
|
|
1276
1296
|
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
@@ -1298,20 +1318,24 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
1298
1318
|
* @returns 合并后的请求配置
|
|
1299
1319
|
*/
|
|
1300
1320
|
const getBilibiliDefaultConfig = (cookie, requestConfig) => {
|
|
1321
|
+
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";
|
|
1322
|
+
finalUserAgent = finalUserAgent.replace(/\s+Edg\/[\d.]+/g, "");
|
|
1301
1323
|
const defHeaders = {
|
|
1302
1324
|
Accept: "application/json, text/plain, */*",
|
|
1303
|
-
"Accept-Language": "zh-CN,zh;q=0.9
|
|
1304
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
1305
|
-
|
|
1325
|
+
"Accept-Language": "zh-CN,zh;q=0.9",
|
|
1326
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
1327
|
+
"Cache-Control": "no-cache",
|
|
1328
|
+
Pragma: "no-cache",
|
|
1306
1329
|
Referer: "https://www.bilibili.com/",
|
|
1307
1330
|
Priority: "u=1, i",
|
|
1308
|
-
"Sec-Ch-Ua":
|
|
1331
|
+
"Sec-Ch-Ua": generateSecChUa(finalUserAgent),
|
|
1309
1332
|
"Sec-Ch-Ua-Mobile": "?0",
|
|
1310
1333
|
"Sec-Ch-Ua-Platform": "\"Windows\"",
|
|
1311
1334
|
"Sec-Fetch-Dest": "empty",
|
|
1312
1335
|
"Sec-Fetch-Mode": "cors",
|
|
1313
1336
|
"Sec-Fetch-Site": "same-site",
|
|
1314
|
-
|
|
1337
|
+
"User-Agent": finalUserAgent,
|
|
1338
|
+
Cookie: cookie?.trim() ?? ""
|
|
1315
1339
|
};
|
|
1316
1340
|
return {
|
|
1317
1341
|
method: "GET",
|
|
@@ -1339,7 +1363,7 @@ const getKuaishouDefaultConfig = (cookie, requestConfig) => {
|
|
|
1339
1363
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1340
1364
|
Priority: "u=0, i",
|
|
1341
1365
|
"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",
|
|
1342
|
-
Cookie: cookie
|
|
1366
|
+
Cookie: cookie?.trim() ?? ""
|
|
1343
1367
|
};
|
|
1344
1368
|
return {
|
|
1345
1369
|
method: "POST",
|
|
@@ -1421,7 +1445,12 @@ var BiLiBiLiAPI = class {
|
|
|
1421
1445
|
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data$1.cid}&ep_id=${data$1.ep_id}`;
|
|
1422
1446
|
}
|
|
1423
1447
|
用户空间动态(data$1) {
|
|
1424
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space
|
|
1448
|
+
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?${new URLSearchParams({
|
|
1449
|
+
host_mid: data$1.host_mid.toString(),
|
|
1450
|
+
offset: "",
|
|
1451
|
+
platform: "web",
|
|
1452
|
+
features: "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,avatarAutoTheme,sunflowerStyle,eva3CardOpus,eva3CardVideo,eva3CardComment"
|
|
1453
|
+
}).toString()}`;
|
|
1425
1454
|
}
|
|
1426
1455
|
动态详情(data$1) {
|
|
1427
1456
|
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`;
|
|
@@ -1459,6 +1488,30 @@ var BiLiBiLiAPI = class {
|
|
|
1459
1488
|
文集基本信息(data$1) {
|
|
1460
1489
|
return `https://api.bilibili.com/x/article/list/web/articles?id=${data$1.id}`;
|
|
1461
1490
|
}
|
|
1491
|
+
用户空间详细信息(data$1) {
|
|
1492
|
+
return `https://api.bilibili.com/x/space/wbi/acc/info?mid=${data$1.host_mid}`;
|
|
1493
|
+
}
|
|
1494
|
+
从_v_voucher_申请_captcha(data$1) {
|
|
1495
|
+
return {
|
|
1496
|
+
Url: "https://api.bilibili.com/x/gaia-vgate/v1/register",
|
|
1497
|
+
Body: {
|
|
1498
|
+
...data$1.csrf !== void 0 && { csrf: data$1.csrf },
|
|
1499
|
+
v_voucher: data$1.v_voucher
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
验证验证码结果(data$1) {
|
|
1504
|
+
return {
|
|
1505
|
+
Url: "https://api.bilibili.com/x/gaia-vgate/v1/validate",
|
|
1506
|
+
Body: {
|
|
1507
|
+
challenge: data$1.challenge,
|
|
1508
|
+
token: data$1.token,
|
|
1509
|
+
validate: data$1.validate,
|
|
1510
|
+
seccode: data$1.seccode,
|
|
1511
|
+
...data$1.csrf !== void 0 && { csrf: data$1.csrf }
|
|
1512
|
+
}
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1462
1515
|
};
|
|
1463
1516
|
/** 该类下的所有方法只会返回拼接好参数后的 Url 地址,需要手动请求该地址以获取数据 */
|
|
1464
1517
|
const bilibiliApiUrls = new BiLiBiLiAPI();
|
|
@@ -1520,7 +1573,10 @@ const bilibili = {
|
|
|
1520
1573
|
getArticleContent: createBilibiliApiMethod("专栏正文内容"),
|
|
1521
1574
|
getArticleCard: createBilibiliApiMethod("专栏显示卡片信息"),
|
|
1522
1575
|
getArticleInfo: createBilibiliApiMethod("专栏文章基本信息"),
|
|
1523
|
-
getColumnInfo: createBilibiliApiMethod("文集基本信息")
|
|
1576
|
+
getColumnInfo: createBilibiliApiMethod("文集基本信息"),
|
|
1577
|
+
getUserProfileDetail: createBilibiliApiMethod("用户空间详细信息"),
|
|
1578
|
+
applyVoucherCaptcha: createBilibiliApiMethod("从_v_voucher_申请_captcha"),
|
|
1579
|
+
validateCaptcha: createBilibiliApiMethod("验证验证码结果")
|
|
1524
1580
|
};
|
|
1525
1581
|
/**
|
|
1526
1582
|
* 创建绑定了cookie的B站API对象
|
|
@@ -1551,7 +1607,10 @@ const createBoundBilibiliApi = (cookie, requestConfig) => {
|
|
|
1551
1607
|
getArticleContent: createBoundBilibiliApiMethod("专栏正文内容", cookie),
|
|
1552
1608
|
getArticleCard: createBoundBilibiliApiMethod("专栏显示卡片信息", cookie),
|
|
1553
1609
|
getArticleInfo: createBoundBilibiliApiMethod("专栏文章基本信息", cookie),
|
|
1554
|
-
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie)
|
|
1610
|
+
getColumnInfo: createBoundBilibiliApiMethod("文集基本信息", cookie),
|
|
1611
|
+
getUserProfileDetail: createBoundBilibiliApiMethod("用户空间详细信息", cookie),
|
|
1612
|
+
applyVoucherCaptcha: createBoundBilibiliApiMethod("从_v_voucher_申请_captcha", cookie),
|
|
1613
|
+
validateCaptcha: createBoundBilibiliApiMethod("验证验证码结果", cookie)
|
|
1555
1614
|
};
|
|
1556
1615
|
};
|
|
1557
1616
|
|
|
@@ -1972,17 +2031,7 @@ const qtparam = async (BASEURL, cookie) => {
|
|
|
1972
2031
|
* @returns 返回B站数据
|
|
1973
2032
|
*/
|
|
1974
2033
|
const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
1975
|
-
const
|
|
1976
|
-
const baseRequestConfig = {
|
|
1977
|
-
method: "GET",
|
|
1978
|
-
timeout: 1e4,
|
|
1979
|
-
...requestConfig,
|
|
1980
|
-
headers: {
|
|
1981
|
-
Referer: "https://www.bilibili.com/",
|
|
1982
|
-
...defHeaders,
|
|
1983
|
-
...requestConfig?.headers ?? {}
|
|
1984
|
-
}
|
|
1985
|
-
};
|
|
2034
|
+
const baseRequestConfig = getBilibiliDefaultConfig(cookie, requestConfig);
|
|
1986
2035
|
switch (data$1.methodType) {
|
|
1987
2036
|
case "单个视频作品数据": return await GlobalGetData$3(data$1.methodType, {
|
|
1988
2037
|
...baseRequestConfig,
|
|
@@ -2096,44 +2145,41 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2096
2145
|
}
|
|
2097
2146
|
case "用户主页动态列表数据": {
|
|
2098
2147
|
const { host_mid } = data$1;
|
|
2099
|
-
const
|
|
2100
|
-
|
|
2101
|
-
headers
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
Origin: "https://space.bilibili.com"
|
|
2105
|
-
}
|
|
2148
|
+
const hasExternalReferer = requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers);
|
|
2149
|
+
const customHeaders = {
|
|
2150
|
+
...baseRequestConfig.headers,
|
|
2151
|
+
Origin: "https://space.bilibili.com",
|
|
2152
|
+
...!hasExternalReferer && { Referer: `https://space.bilibili.com/${host_mid}/dynamic` }
|
|
2106
2153
|
};
|
|
2107
2154
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2108
2155
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2109
|
-
...
|
|
2156
|
+
...baseRequestConfig,
|
|
2157
|
+
headers: customHeaders,
|
|
2110
2158
|
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2111
2159
|
});
|
|
2112
2160
|
}
|
|
2113
2161
|
case "动态详情数据": {
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2116
|
-
headers
|
|
2117
|
-
|
|
2118
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2119
|
-
}
|
|
2162
|
+
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
2163
|
+
const customHeaders = {
|
|
2164
|
+
...baseRequestConfig.headers,
|
|
2165
|
+
...!hasExternalReferer && { Referer: void 0 }
|
|
2120
2166
|
};
|
|
2121
2167
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2122
|
-
...
|
|
2168
|
+
...baseRequestConfig,
|
|
2169
|
+
headers: customHeaders,
|
|
2123
2170
|
url: bilibiliApiUrls.动态详情({ dynamic_id: data$1.dynamic_id })
|
|
2124
2171
|
});
|
|
2125
2172
|
}
|
|
2126
2173
|
case "动态卡片数据": {
|
|
2127
|
-
const customConfig = {
|
|
2128
|
-
...baseRequestConfig,
|
|
2129
|
-
headers: {
|
|
2130
|
-
...baseRequestConfig.headers,
|
|
2131
|
-
...(!requestConfig?.headers || !("referer" in requestConfig.headers)) && { referer: void 0 }
|
|
2132
|
-
}
|
|
2133
|
-
};
|
|
2134
2174
|
const { dynamic_id } = data$1;
|
|
2175
|
+
const hasExternalReferer = requestConfig?.headers && "referer" in requestConfig.headers;
|
|
2176
|
+
const customHeaders = {
|
|
2177
|
+
...baseRequestConfig.headers,
|
|
2178
|
+
...!hasExternalReferer && { Referer: void 0 }
|
|
2179
|
+
};
|
|
2135
2180
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2136
|
-
...
|
|
2181
|
+
...baseRequestConfig,
|
|
2182
|
+
headers: customHeaders,
|
|
2137
2183
|
url: bilibiliApiUrls.动态卡片信息({ dynamic_id })
|
|
2138
2184
|
});
|
|
2139
2185
|
}
|
|
@@ -2144,6 +2190,13 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2144
2190
|
url: bilibiliApiUrls.用户名片信息({ host_mid })
|
|
2145
2191
|
});
|
|
2146
2192
|
}
|
|
2193
|
+
case "用户空间详细信息": {
|
|
2194
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间详细信息({ host_mid: data$1.host_mid }), baseRequestConfig.headers?.cookie);
|
|
2195
|
+
return await GlobalGetData$3(data$1.methodType, {
|
|
2196
|
+
...baseRequestConfig,
|
|
2197
|
+
url: bilibiliApiUrls.用户空间详细信息({ host_mid: data$1.host_mid }) + wbiSignQuery
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2147
2200
|
case "直播间信息": return await GlobalGetData$3(data$1.methodType, {
|
|
2148
2201
|
...baseRequestConfig,
|
|
2149
2202
|
url: bilibiliApiUrls.直播间信息({ room_id: data$1.room_id })
|
|
@@ -2239,6 +2292,18 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2239
2292
|
...baseRequestConfig,
|
|
2240
2293
|
url: bilibiliApiUrls.文集基本信息({ id: data$1.id })
|
|
2241
2294
|
});
|
|
2295
|
+
case "从_v_voucher_申请_captcha": return await GlobalGetData$3(data$1.methodType, {
|
|
2296
|
+
...baseRequestConfig,
|
|
2297
|
+
method: "POST",
|
|
2298
|
+
url: bilibiliApiUrls.从_v_voucher_申请_captcha(data$1).Url,
|
|
2299
|
+
data: bilibiliApiUrls.从_v_voucher_申请_captcha(data$1).Body
|
|
2300
|
+
});
|
|
2301
|
+
case "验证验证码结果": return await GlobalGetData$3(data$1.methodType, {
|
|
2302
|
+
...baseRequestConfig,
|
|
2303
|
+
method: "POST",
|
|
2304
|
+
url: bilibiliApiUrls.验证验证码结果(data$1).Url,
|
|
2305
|
+
data: bilibiliApiUrls.验证验证码结果(data$1).Body
|
|
2306
|
+
});
|
|
2242
2307
|
default:
|
|
2243
2308
|
logger.warn(`未知的B站数据接口:「${logger.red(data$1.methodType)}」`);
|
|
2244
2309
|
return null;
|
|
@@ -2380,7 +2445,9 @@ const bilibiliErrorCodeMap = {
|
|
|
2380
2445
|
"-689": "版权限制",
|
|
2381
2446
|
"-701": "扣节操失败",
|
|
2382
2447
|
"-799": "请求过于频繁,请稍后再试",
|
|
2383
|
-
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)"
|
|
2448
|
+
"-8888": "对不起,服务器开小差了~ (ಥ﹏ಥ)",
|
|
2449
|
+
1e5: "验证码获取失败",
|
|
2450
|
+
100003: "验证码过期"
|
|
2384
2451
|
};
|
|
2385
2452
|
|
|
2386
2453
|
//#endregion
|
|
@@ -4476,16 +4543,19 @@ async function getBilibiliData(methodType, optionsOrCookie, cookieOrOptions, req
|
|
|
4476
4543
|
try {
|
|
4477
4544
|
let options;
|
|
4478
4545
|
let cookie;
|
|
4546
|
+
let config;
|
|
4479
4547
|
if (typeof optionsOrCookie === "string") {
|
|
4480
4548
|
cookie = optionsOrCookie;
|
|
4481
4549
|
options = cookieOrOptions;
|
|
4550
|
+
config = requestConfig;
|
|
4482
4551
|
} else {
|
|
4483
4552
|
options = optionsOrCookie;
|
|
4484
4553
|
cookie = cookieOrOptions;
|
|
4554
|
+
config = requestConfig;
|
|
4485
4555
|
}
|
|
4486
4556
|
const { typeMode: _, ...validationOptions } = options ?? {};
|
|
4487
|
-
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, validationOptions) }, cookie);
|
|
4488
|
-
if (rawData.code !== 0) return createErrorResponse(rawData.amagiError, "B站数据获取失败");
|
|
4557
|
+
const rawData = await fetchBilibili({ ...validateBilibiliParams(methodType, validationOptions) }, cookie, config);
|
|
4558
|
+
if (rawData.code !== 0) return createErrorResponse(rawData.amagiError, "B站数据获取失败", rawData.code, rawData.data);
|
|
4489
4559
|
return createSuccessResponse(rawData, "获取成功", 200);
|
|
4490
4560
|
} catch (error) {
|
|
4491
4561
|
const errorMessage = error instanceof Error ? error.message : "未知错误";
|
|
@@ -5103,7 +5173,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
5103
5173
|
|
|
5104
5174
|
//#endregion
|
|
5105
5175
|
//#region src/index.ts
|
|
5106
|
-
const VERSION = "5.
|
|
5176
|
+
const VERSION = "5.12.0";
|
|
5107
5177
|
/**
|
|
5108
5178
|
* @deprecated 请使用 createAmagiClient 替代
|
|
5109
5179
|
*/
|
|
@@ -5139,4 +5209,4 @@ const Client = CreateApp;
|
|
|
5139
5209
|
const amagi = Client;
|
|
5140
5210
|
|
|
5141
5211
|
//#endregion
|
|
5142
|
-
export { AdditionalType, ApiError, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodRoutes, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinHotWordsParamsSchema, DouyinLiveRoomParamsSchema, DouyinMethodRoutes, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouMethodRoutes, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, ValidationError, XiaohongshuMethodRoutes, XiaohongshuValidationSchemas, amagi, amagiClient, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundDouyinApi, createBoundKuaishouApi, createBoundXiaohongshuApi, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinSign, douyinUtils, fetchData, fetchResponse, getBilibiliData, getDouyinData, getHeadersAndData, getKuaishouData, handleError, httpLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, qtparam, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuSign, xiaohongshuUtils };
|
|
5212
|
+
export { AdditionalType, ApiError, BilibiliApplyCaptchaParamsSchema, BilibiliArticleCardParamsSchema, BilibiliArticleInfoParamsSchema, BilibiliArticleParamsSchema, BilibiliAv2BvParamsSchema, BilibiliBangumiInfoParamsSchema, BilibiliBangumiStreamParamsSchema, BilibiliBv2AvParamsSchema, BilibiliColumnInfoParamsSchema, BilibiliCommentParamsSchema, BilibiliCommentReplyParamsSchema, BilibiliDynamicParamsSchema, BilibiliEmojiParamsSchema, BilibiliLiveParamsSchema, BilibiliLoginParamsSchema, BilibiliMethodRoutes, BilibiliQrcodeParamsSchema, BilibiliQrcodeStatusParamsSchema, BilibiliUserParamsSchema, BilibiliValidateCaptchaParamsSchema, BilibiliValidationSchemas, BilibiliVideoDownloadParamsSchema, BilibiliVideoParamsSchema, CommentType, CreateApp, DouyinCommentParamsSchema, DouyinCommentReplyParamsSchema, DouyinDanmakuParamsSchema, DouyinEmojiListParamsSchema, DouyinEmojiProParamsSchema, DouyinHotWordsParamsSchema, DouyinLiveRoomParamsSchema, DouyinMethodRoutes, DouyinMusicParamsSchema, DouyinQrcodeParamsSchema, DouyinSearchParamsSchema, DouyinUserParamsSchema, DouyinValidationSchemas, DouyinWorkParamsSchema, DynamicType, KuaishouCommentParamsSchema, KuaishouEmojiParamsSchema, KuaishouMethodRoutes, KuaishouValidationSchemas, KuaishouVideoParamsSchema, MajorType, ValidationError, XiaohongshuMethodRoutes, XiaohongshuValidationSchemas, amagi, amagiClient, av2bv, bilibili, bilibiliApiUrls, bilibiliErrorCodeMap, bilibiliUtils, bv2av, createAmagiClient, createBilibiliRoutes, createBilibiliRoutes as registerBilibiliRoutes, createBoundBilibiliApi, createBoundDouyinApi, createBoundKuaishouApi, createBoundXiaohongshuApi, createDouyinRoutes, createDouyinRoutes as registerDouyinRoutes, createErrorResponse, createKuaishouRoutes, createKuaishouRoutes as registerKuaishouRoutes, createSuccessResponse, createXiaohongshuRoutes, createXiaohongshuRoutes as registerXiaohongshuRoutes, Client as default, douyin, douyinApiUrls, douyinSign, douyinUtils, fetchData, fetchResponse, getBilibiliData, getDouyinData, getHeadersAndData, getKuaishouData, handleError, httpLogger, isNetworkErrorResult, kuaishou, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, qtparam, validateBilibiliParams, validateDouyinParams, validateKuaishouParams, validateXiaohongshuParams, wbi_sign, xiaohongshu, xiaohongshuApiUrls, xiaohongshuSign, xiaohongshuUtils };
|