@ikenxuan/amagi 5.0.2 → 5.0.3
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/cjs/index.cjs +40 -5
- package/dist/default/esm/index.mjs +40 -5
- package/dist/default/index.d.ts +9 -25
- package/package.json +1 -1
|
@@ -735,11 +735,46 @@ var fetchBilibili = async (data2, cookie, requestConfig) => {
|
|
|
735
735
|
return result;
|
|
736
736
|
}
|
|
737
737
|
case "\u4E8C\u7EF4\u7801\u72B6\u6001": {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
738
|
+
try {
|
|
739
|
+
const result = await getHeadersAndData({
|
|
740
|
+
...baseRequestConfig,
|
|
741
|
+
url: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
742
|
+
});
|
|
743
|
+
if (result.data.code !== 0) {
|
|
744
|
+
const errorMessage = bilibiliErrorCodeMap[String(result.data.code)] || result.data.message || "\u672A\u77E5\u9519\u8BEF";
|
|
745
|
+
const Err = {
|
|
746
|
+
errorDescription: `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u539F\u56E0\uFF1A${errorMessage}\uFF01`,
|
|
747
|
+
requestType: data2.methodType,
|
|
748
|
+
requestUrl: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
749
|
+
};
|
|
750
|
+
return {
|
|
751
|
+
code: result.data.code,
|
|
752
|
+
data: result.data,
|
|
753
|
+
amagiError: Err
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
return {
|
|
757
|
+
code: 0,
|
|
758
|
+
data: {
|
|
759
|
+
data: result.data.data,
|
|
760
|
+
headers: result.headers
|
|
761
|
+
},
|
|
762
|
+
message: "0"
|
|
763
|
+
};
|
|
764
|
+
} catch (error) {
|
|
765
|
+
if (error && typeof error === "object") {
|
|
766
|
+
return error;
|
|
767
|
+
}
|
|
768
|
+
return {
|
|
769
|
+
code: "UNKNOWN_ERROR" /* UNKNOWN */,
|
|
770
|
+
data: error.data,
|
|
771
|
+
amagiError: {
|
|
772
|
+
errorDescription: "\u672A\u77E5\u9519\u8BEF",
|
|
773
|
+
requestType: data2.methodType,
|
|
774
|
+
requestUrl: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
}
|
|
743
778
|
}
|
|
744
779
|
case "\u767B\u5F55\u57FA\u672C\u4FE1\u606F": {
|
|
745
780
|
const result = await GlobalGetData(data2.methodType, {
|
|
@@ -719,11 +719,46 @@ var fetchBilibili = async (data2, cookie, requestConfig) => {
|
|
|
719
719
|
return result;
|
|
720
720
|
}
|
|
721
721
|
case "\u4E8C\u7EF4\u7801\u72B6\u6001": {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
722
|
+
try {
|
|
723
|
+
const result = await getHeadersAndData({
|
|
724
|
+
...baseRequestConfig,
|
|
725
|
+
url: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
726
|
+
});
|
|
727
|
+
if (result.data.code !== 0) {
|
|
728
|
+
const errorMessage = bilibiliErrorCodeMap[String(result.data.code)] || result.data.message || "\u672A\u77E5\u9519\u8BEF";
|
|
729
|
+
const Err = {
|
|
730
|
+
errorDescription: `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u539F\u56E0\uFF1A${errorMessage}\uFF01`,
|
|
731
|
+
requestType: data2.methodType,
|
|
732
|
+
requestUrl: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
733
|
+
};
|
|
734
|
+
return {
|
|
735
|
+
code: result.data.code,
|
|
736
|
+
data: result.data,
|
|
737
|
+
amagiError: Err
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
code: 0,
|
|
742
|
+
data: {
|
|
743
|
+
data: result.data.data,
|
|
744
|
+
headers: result.headers
|
|
745
|
+
},
|
|
746
|
+
message: "0"
|
|
747
|
+
};
|
|
748
|
+
} catch (error) {
|
|
749
|
+
if (error && typeof error === "object") {
|
|
750
|
+
return error;
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
code: "UNKNOWN_ERROR" /* UNKNOWN */,
|
|
754
|
+
data: error.data,
|
|
755
|
+
amagiError: {
|
|
756
|
+
errorDescription: "\u672A\u77E5\u9519\u8BEF",
|
|
757
|
+
requestType: data2.methodType,
|
|
758
|
+
requestUrl: bilibiliApiUrls.\u4E8C\u7EF4\u7801\u72B6\u6001({ qrcode_key: data2.qrcode_key })
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
}
|
|
727
762
|
}
|
|
728
763
|
case "\u767B\u5F55\u57FA\u672C\u4FE1\u606F": {
|
|
729
764
|
const result = await GlobalGetData(data2.methodType, {
|
package/dist/default/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import * as express from 'express';
|
|
3
4
|
import express__default, { Router, RequestHandler } from 'express';
|
|
4
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
5
5
|
import { ChalkInstance } from 'chalk';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9709,18 +9709,17 @@ type StudioInfo = {
|
|
|
9709
9709
|
};
|
|
9710
9710
|
|
|
9711
9711
|
type BiliCheckQrcode = {
|
|
9712
|
-
data: CheckQrcodeData;
|
|
9713
|
-
headers: Headers;
|
|
9714
|
-
[property: string]: any;
|
|
9715
|
-
};
|
|
9716
|
-
type CheckQrcodeData = {
|
|
9717
9712
|
code: number;
|
|
9718
|
-
data:
|
|
9713
|
+
data: PurpleData;
|
|
9719
9714
|
message: string;
|
|
9720
|
-
ttl: number;
|
|
9721
9715
|
[property: string]: any;
|
|
9722
9716
|
};
|
|
9723
|
-
type
|
|
9717
|
+
type PurpleData = {
|
|
9718
|
+
data: FluffyData;
|
|
9719
|
+
headers: AxiosResponse['headers'];
|
|
9720
|
+
[property: string]: any;
|
|
9721
|
+
};
|
|
9722
|
+
type FluffyData = {
|
|
9724
9723
|
code: number;
|
|
9725
9724
|
message: string;
|
|
9726
9725
|
refresh_token: string;
|
|
@@ -9728,21 +9727,6 @@ type DataData$1 = {
|
|
|
9728
9727
|
url: string;
|
|
9729
9728
|
[property: string]: any;
|
|
9730
9729
|
};
|
|
9731
|
-
type Headers = {
|
|
9732
|
-
'bili-status-code': string;
|
|
9733
|
-
'bili-trace-id': string;
|
|
9734
|
-
'cache-control': string;
|
|
9735
|
-
connection: string;
|
|
9736
|
-
'content-type': string;
|
|
9737
|
-
cpu_usage: string;
|
|
9738
|
-
date: string;
|
|
9739
|
-
expires: string;
|
|
9740
|
-
'transfer-encoding': string;
|
|
9741
|
-
'x-bili-trace-id': string;
|
|
9742
|
-
'x-cache-webcdn': string;
|
|
9743
|
-
'x-ticket-status': string;
|
|
9744
|
-
[property: string]: any;
|
|
9745
|
-
};
|
|
9746
9730
|
|
|
9747
9731
|
type BiliNewLoginQrcode = {
|
|
9748
9732
|
code: number;
|
|
@@ -16178,7 +16162,7 @@ declare const fetchResponse: <T = unknown>(config: AxiosRequestConfig) => Promis
|
|
|
16178
16162
|
* @returns 包含headers和data的对象
|
|
16179
16163
|
*/
|
|
16180
16164
|
declare const getHeadersAndData: <T = any>(config: AxiosRequestConfig) => Promise<{
|
|
16181
|
-
headers:
|
|
16165
|
+
headers: AxiosResponse<T>["headers"];
|
|
16182
16166
|
data: T;
|
|
16183
16167
|
}>;
|
|
16184
16168
|
|