@ikenxuan/amagi 5.9.0 → 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/default/index.cjs +24 -2
- package/dist/default/index.js +24 -2
- package/package.json +1 -1
package/dist/default/index.cjs
CHANGED
|
@@ -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,7 +4793,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4771
4793
|
|
|
4772
4794
|
//#endregion
|
|
4773
4795
|
//#region src/index.ts
|
|
4774
|
-
const VERSION = "5.9.
|
|
4796
|
+
const VERSION = "5.9.1";
|
|
4775
4797
|
/**
|
|
4776
4798
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4777
4799
|
*/
|
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,7 +4783,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4761
4783
|
|
|
4762
4784
|
//#endregion
|
|
4763
4785
|
//#region src/index.ts
|
|
4764
|
-
const VERSION = "5.9.
|
|
4786
|
+
const VERSION = "5.9.1";
|
|
4765
4787
|
/**
|
|
4766
4788
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4767
4789
|
*/
|