@ikenxuan/amagi 5.8.1 → 5.9.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/{chunk-CUT6urMc.cjs → chunk-CbDLau6x.cjs} +10 -6
- package/dist/default/index.cjs +31 -2
- package/dist/default/index.d.cts +2 -0
- package/dist/default/index.d.ts +2 -0
- package/dist/default/index.js +30 -1
- package/dist/exports/axios.cjs +1 -1
- package/dist/exports/express.cjs +1 -1
- package/dist/exports/log4js.cjs +1 -1
- package/package.json +1 -1
|
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
return to;
|
|
17
21
|
};
|
package/dist/default/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const require_chunk = require('../chunk-
|
|
2
|
+
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_chunk.__toESM(node_fs);
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -2022,9 +2022,10 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
};
|
|
2024
2024
|
const { host_mid } = data$1;
|
|
2025
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2025
2026
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2026
2027
|
...customConfig,
|
|
2027
|
-
url: bilibiliApiUrls.用户空间动态({ host_mid })
|
|
2028
|
+
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2028
2029
|
});
|
|
2029
2030
|
}
|
|
2030
2031
|
case "动态详情数据": {
|
|
@@ -2158,6 +2159,27 @@ const GlobalGetData$3 = async (type, options) => {
|
|
|
2158
2159
|
let warningMessage = "";
|
|
2159
2160
|
try {
|
|
2160
2161
|
const result = await fetchData(options);
|
|
2162
|
+
if (typeof result === "string" && result.includes("<!DOCTYPE html>")) {
|
|
2163
|
+
const Err = {
|
|
2164
|
+
errorDescription: "触发B站风控策略,请求被拦截!可能原因:请求频率过高、Cookie失效、缺少必要请求头",
|
|
2165
|
+
requestType: type ?? "未知请求类型",
|
|
2166
|
+
requestUrl: options.url
|
|
2167
|
+
};
|
|
2168
|
+
warningMessage = `
|
|
2169
|
+
${logger.red("触发B站风控策略,请求被拦截")}
|
|
2170
|
+
请求类型:「${type}」
|
|
2171
|
+
请求URL:${options.url}
|
|
2172
|
+
建议:降低请求频率、检查Cookie
|
|
2173
|
+
`;
|
|
2174
|
+
logger.warn(warningMessage);
|
|
2175
|
+
const riskError = new Error(Err.errorDescription);
|
|
2176
|
+
Object.assign(riskError, {
|
|
2177
|
+
code: bilibiliAPIErrorCode.IP_BLOCKED,
|
|
2178
|
+
data: result,
|
|
2179
|
+
amagiError: Err
|
|
2180
|
+
});
|
|
2181
|
+
throw riskError;
|
|
2182
|
+
}
|
|
2161
2183
|
if (!result || result === "") {
|
|
2162
2184
|
const Err = {
|
|
2163
2185
|
errorDescription: "获取响应数据失败!接口返回内容为空,你的B站ck可能已经失效!",
|
|
@@ -4771,6 +4793,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4771
4793
|
|
|
4772
4794
|
//#endregion
|
|
4773
4795
|
//#region src/index.ts
|
|
4796
|
+
const VERSION = "5.9.1";
|
|
4774
4797
|
/**
|
|
4775
4798
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4776
4799
|
*/
|
|
@@ -4785,6 +4808,12 @@ function CreateAmagiApp(options = {}) {
|
|
|
4785
4808
|
if (!(this instanceof CreateAmagiApp)) return createAmagiClient(options);
|
|
4786
4809
|
return createAmagiClient(options);
|
|
4787
4810
|
}
|
|
4811
|
+
Object.defineProperty(CreateAmagiApp, "version", {
|
|
4812
|
+
value: VERSION,
|
|
4813
|
+
writable: false,
|
|
4814
|
+
enumerable: true,
|
|
4815
|
+
configurable: false
|
|
4816
|
+
});
|
|
4788
4817
|
CreateAmagiApp.douyin = douyinUtils;
|
|
4789
4818
|
CreateAmagiApp.bilibili = bilibiliUtils;
|
|
4790
4819
|
CreateAmagiApp.kuaishou = kuaishouUtils;
|
package/dist/default/index.d.cts
CHANGED
|
@@ -22411,6 +22411,8 @@ declare const amagiClient: typeof createAmagiClient;
|
|
|
22411
22411
|
type AmagiConstructor = {
|
|
22412
22412
|
new (options?: Options): ReturnType<typeof createAmagiClient>;
|
|
22413
22413
|
(options?: Options): ReturnType<typeof createAmagiClient>;
|
|
22414
|
+
/** 当前版本号 */
|
|
22415
|
+
readonly version: string;
|
|
22414
22416
|
/** 抖音相关功能模块 (工具集) */
|
|
22415
22417
|
douyin: typeof douyinUtils;
|
|
22416
22418
|
/** B站相关功能模块 (工具集) */
|
package/dist/default/index.d.ts
CHANGED
|
@@ -22411,6 +22411,8 @@ declare const amagiClient: typeof createAmagiClient;
|
|
|
22411
22411
|
type AmagiConstructor = {
|
|
22412
22412
|
new (options?: Options): ReturnType<typeof createAmagiClient>;
|
|
22413
22413
|
(options?: Options): ReturnType<typeof createAmagiClient>;
|
|
22414
|
+
/** 当前版本号 */
|
|
22415
|
+
readonly version: string;
|
|
22414
22416
|
/** 抖音相关功能模块 (工具集) */
|
|
22415
22417
|
douyin: typeof douyinUtils;
|
|
22416
22418
|
/** B站相关功能模块 (工具集) */
|
package/dist/default/index.js
CHANGED
|
@@ -2012,9 +2012,10 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
};
|
|
2014
2014
|
const { host_mid } = data$1;
|
|
2015
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2015
2016
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2016
2017
|
...customConfig,
|
|
2017
|
-
url: bilibiliApiUrls.用户空间动态({ host_mid })
|
|
2018
|
+
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2018
2019
|
});
|
|
2019
2020
|
}
|
|
2020
2021
|
case "动态详情数据": {
|
|
@@ -2148,6 +2149,27 @@ const GlobalGetData$3 = async (type, options) => {
|
|
|
2148
2149
|
let warningMessage = "";
|
|
2149
2150
|
try {
|
|
2150
2151
|
const result = await fetchData(options);
|
|
2152
|
+
if (typeof result === "string" && result.includes("<!DOCTYPE html>")) {
|
|
2153
|
+
const Err = {
|
|
2154
|
+
errorDescription: "触发B站风控策略,请求被拦截!可能原因:请求频率过高、Cookie失效、缺少必要请求头",
|
|
2155
|
+
requestType: type ?? "未知请求类型",
|
|
2156
|
+
requestUrl: options.url
|
|
2157
|
+
};
|
|
2158
|
+
warningMessage = `
|
|
2159
|
+
${logger.red("触发B站风控策略,请求被拦截")}
|
|
2160
|
+
请求类型:「${type}」
|
|
2161
|
+
请求URL:${options.url}
|
|
2162
|
+
建议:降低请求频率、检查Cookie
|
|
2163
|
+
`;
|
|
2164
|
+
logger.warn(warningMessage);
|
|
2165
|
+
const riskError = new Error(Err.errorDescription);
|
|
2166
|
+
Object.assign(riskError, {
|
|
2167
|
+
code: bilibiliAPIErrorCode.IP_BLOCKED,
|
|
2168
|
+
data: result,
|
|
2169
|
+
amagiError: Err
|
|
2170
|
+
});
|
|
2171
|
+
throw riskError;
|
|
2172
|
+
}
|
|
2151
2173
|
if (!result || result === "") {
|
|
2152
2174
|
const Err = {
|
|
2153
2175
|
errorDescription: "获取响应数据失败!接口返回内容为空,你的B站ck可能已经失效!",
|
|
@@ -4761,6 +4783,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4761
4783
|
|
|
4762
4784
|
//#endregion
|
|
4763
4785
|
//#region src/index.ts
|
|
4786
|
+
const VERSION = "5.9.1";
|
|
4764
4787
|
/**
|
|
4765
4788
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4766
4789
|
*/
|
|
@@ -4775,6 +4798,12 @@ function CreateAmagiApp(options = {}) {
|
|
|
4775
4798
|
if (!(this instanceof CreateAmagiApp)) return createAmagiClient(options);
|
|
4776
4799
|
return createAmagiClient(options);
|
|
4777
4800
|
}
|
|
4801
|
+
Object.defineProperty(CreateAmagiApp, "version", {
|
|
4802
|
+
value: VERSION,
|
|
4803
|
+
writable: false,
|
|
4804
|
+
enumerable: true,
|
|
4805
|
+
configurable: false
|
|
4806
|
+
});
|
|
4778
4807
|
CreateAmagiApp.douyin = douyinUtils;
|
|
4779
4808
|
CreateAmagiApp.bilibili = bilibiliUtils;
|
|
4780
4809
|
CreateAmagiApp.kuaishou = kuaishouUtils;
|
package/dist/exports/axios.cjs
CHANGED
package/dist/exports/express.cjs
CHANGED
package/dist/exports/log4js.cjs
CHANGED