@ikenxuan/amagi 2.0.1 → 2.1.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/README.md +5 -10
- package/lib/business/bilibili/getdata.d.ts +2 -2
- package/lib/business/bilibili/getdata.js +1 -1
- package/lib/business/bilibili/result.d.ts +12 -5
- package/lib/business/bilibili/result.js +33 -40
- package/lib/business/douyin/getdata.d.ts +2 -2
- package/lib/business/douyin/getdata.js +24 -13
- package/lib/business/douyin/result.d.ts +6 -5
- package/lib/business/douyin/result.js +29 -42
- package/lib/business/douyin/sign/a_bogus.js +8 -8
- package/lib/business/index.d.ts +2 -2
- package/lib/business/index.js +2 -2
- package/lib/index.d.ts +17 -0
- package/lib/index.js +23 -0
- package/lib/model/dir.d.ts +3 -3
- package/lib/model/dir.js +6 -6
- package/lib/model/index.d.ts +3 -3
- package/lib/model/index.js +3 -3
- package/lib/model/networks.d.ts +13 -17
- package/lib/model/networks.js +49 -83
- package/lib/server/client.d.ts +22 -13
- package/lib/server/client.js +138 -80
- package/lib/server/index.d.ts +2 -2
- package/lib/server/index.js +2 -2
- package/lib/server/listen.d.ts +2 -2
- package/lib/server/listen.js +4 -4
- package/lib/types/BilibiliAPIParams.d.ts +1 -1
- package/lib/types/BilibiliAPIParams.js +1 -1
- package/lib/types/ConfigType.js +1 -1
- package/lib/types/DataType.js +1 -1
- package/lib/types/DouyinAPIParams.d.ts +1 -1
- package/lib/types/DouyinAPIParams.js +1 -1
- package/lib/types/GetDataResponseType.js +1 -1
- package/lib/types/NetworksConfigType.js +1 -1
- package/lib/types/OptionsType.js +1 -1
- package/lib/types/Request.d.ts +2 -2
- package/lib/types/Request.js +1 -1
- package/lib/types/index.d.ts +9 -9
- package/lib/types/index.js +1 -1
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -27,19 +27,14 @@ await StartClient(Client.Instance, 4567)
|
|
|
27
27
|
|
|
28
28
|
* 如果你想直接获取数据
|
|
29
29
|
```js
|
|
30
|
-
import
|
|
30
|
+
import { GetDouyinData, GetBilibiliData } from '@ikenxuan/amagi'
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
douyin: '抖音ck',
|
|
35
|
-
bilibili: 'B站ck'
|
|
36
|
-
}).initServer()
|
|
32
|
+
const douyinck = '你的抖音ck'
|
|
33
|
+
const bilibilick = '你的B站ck'
|
|
37
34
|
|
|
38
|
-
const Douyin = await
|
|
39
|
-
.result({ query: '珠江新城CBD' })
|
|
35
|
+
const Douyin = await GetDouyinData('单个视频作品数据', douyinck, { url: 'https://v.douyin.com/irHntHL7' })
|
|
40
36
|
|
|
41
|
-
const Bilibili = await
|
|
42
|
-
.result({ url: 'https://b23.tv/9JvEHhJ' })
|
|
37
|
+
const Bilibili = await GetBilibiliData('单个视频作品数据', bilibilick, { url: 'https://www.bilibili.com/video/BV13S42197ja' })
|
|
43
38
|
```
|
|
44
39
|
type 参数详见 [**API数据类型枚举**](./src/types/DataType.ts)
|
|
45
40
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BilibiliDataType, BilibiliOptionsType, NetworksConfigType } from '../../types/index.js';
|
|
2
2
|
export default class BilibiliData {
|
|
3
|
-
type: BilibiliDataType;
|
|
3
|
+
type: keyof typeof BilibiliDataType;
|
|
4
4
|
headers: any;
|
|
5
5
|
URL: string | undefined;
|
|
6
|
-
constructor(type: BilibiliDataType, cookie: string);
|
|
6
|
+
constructor(type: keyof typeof BilibiliDataType, cookie: string);
|
|
7
7
|
GetData(data?: BilibiliOptionsType): Promise<any>;
|
|
8
8
|
GlobalGetData(options: NetworksConfigType): Promise<any>;
|
|
9
9
|
}
|
|
@@ -51,7 +51,7 @@ export default class BilibiliData {
|
|
|
51
51
|
case "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" /* BilibiliDataType.番剧下载信息数据 */:
|
|
52
52
|
return await this.GlobalGetData({ url: BiLiBiLiAPI.番剧视频流信息({ cid: data.cid, ep_id: data.ep_id }) });
|
|
53
53
|
case "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E" /* BilibiliDataType.用户主页动态列表数据 */:
|
|
54
|
-
delete this.headers.Referer
|
|
54
|
+
// delete this.headers.Referer
|
|
55
55
|
result = await this.GlobalGetData({
|
|
56
56
|
url: BiLiBiLiAPI.用户空间动态({ host_mid: data.host_mid }),
|
|
57
57
|
headers: this.headers
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { BilibiliDataType, BilibiliOptionsType, GetDataResponseType } from '../../types/index.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface resultParams {
|
|
3
|
+
/** 请求数据的类型 */
|
|
4
|
+
type: keyof typeof BilibiliDataType;
|
|
5
|
+
/** B站用户ck */
|
|
4
6
|
cookie: string;
|
|
5
|
-
returndata: boolean;
|
|
6
|
-
constructor(type: BilibiliDataType, cookie: string, returndata?: boolean);
|
|
7
|
-
result(options?: BilibiliOptionsType): Promise<GetDataResponseType>;
|
|
8
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param options
|
|
11
|
+
* @param config
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export default function BilibiliResult(config: resultParams | undefined, options: BilibiliOptionsType): Promise<GetDataResponseType | any>;
|
|
15
|
+
export {};
|
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
import { BilibiliData, GetBilibiliID } from '../../business/bilibili/index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
case "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E" /* BilibiliDataType.番剧基本信息数据 */: {
|
|
28
|
-
const iddata = await GetBilibiliID(options.url);
|
|
29
|
-
result = await new BilibiliData(this.type, this.cookie).GetData(iddata);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
default:
|
|
33
|
-
result = '';
|
|
34
|
-
break;
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param options
|
|
5
|
+
* @param config
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export default async function BilibiliResult(config = { cookie: '' }, options) {
|
|
9
|
+
let data;
|
|
10
|
+
switch (config.type) {
|
|
11
|
+
case "\u7528\u6237\u4E3B\u9875\u6570\u636E" /* BilibiliDataType.用户主页数据 */:
|
|
12
|
+
case "emoji\u6570\u636E" /* BilibiliDataType.emoji数据 */:
|
|
13
|
+
case "\u8BC4\u8BBA\u6570\u636E" /* BilibiliDataType.评论数据 */:
|
|
14
|
+
case "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" /* BilibiliDataType.番剧下载信息数据 */:
|
|
15
|
+
case "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E" /* BilibiliDataType.用户主页动态列表数据 */:
|
|
16
|
+
case "\u52A8\u6001\u8BE6\u60C5\u6570\u636E" /* BilibiliDataType.动态详情数据 */:
|
|
17
|
+
case "\u52A8\u6001\u5361\u7247\u6570\u636E" /* BilibiliDataType.动态卡片数据 */:
|
|
18
|
+
case "\u76F4\u64AD\u95F4\u4FE1\u606F" /* BilibiliDataType.直播间信息 */:
|
|
19
|
+
case "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F" /* BilibiliDataType.直播间初始化信息 */:
|
|
20
|
+
data = await new BilibiliData(config.type, config.cookie).GetData(options);
|
|
21
|
+
break;
|
|
22
|
+
case "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" /* BilibiliDataType.单个视频作品数据 */:
|
|
23
|
+
case "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E" /* BilibiliDataType.番剧基本信息数据 */: {
|
|
24
|
+
const iddata = await GetBilibiliID(options.url);
|
|
25
|
+
data = await new BilibiliData(config.type, config.cookie).GetData(iddata);
|
|
26
|
+
break;
|
|
35
27
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
code: result !== false && result !== '' ? 200 : 503,
|
|
40
|
-
message: result !== !false && result !== '' ? 'success' : 'error',
|
|
41
|
-
data: result !== !false && result !== '' ? result : null
|
|
42
|
-
};
|
|
28
|
+
default:
|
|
29
|
+
data = '';
|
|
30
|
+
break;
|
|
43
31
|
}
|
|
32
|
+
return {
|
|
33
|
+
code: data !== '' ? 200 : 503,
|
|
34
|
+
message: data !== '' ? 'success' : 'error',
|
|
35
|
+
data: data !== '' ? data : null
|
|
36
|
+
};
|
|
44
37
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DouyinDataType, DouyinOptionsType, NetworksConfigType } from '../../types/index.js';
|
|
2
2
|
export default class DouyinData {
|
|
3
|
-
type: DouyinDataType;
|
|
3
|
+
type: keyof typeof DouyinDataType;
|
|
4
4
|
headers: any;
|
|
5
5
|
URL: string | undefined;
|
|
6
|
-
constructor(type: DouyinDataType, cookie: string);
|
|
6
|
+
constructor(type: keyof typeof DouyinDataType, cookie: string);
|
|
7
7
|
GetData(data?: DouyinOptionsType): Promise<any>;
|
|
8
8
|
GlobalGetData(options: NetworksConfigType): Promise<any>;
|
|
9
9
|
}
|
|
@@ -11,14 +11,14 @@ export default class DouyinData {
|
|
|
11
11
|
Cookie: cookie.replace(/\s+/g, ''),
|
|
12
12
|
Accept: '*/*',
|
|
13
13
|
'Content-Type': 'application/json',
|
|
14
|
-
'
|
|
15
|
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
14
|
+
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
|
15
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36'
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
async GetData(data = {}) {
|
|
19
19
|
switch (this.type) {
|
|
20
20
|
case "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.单个视频作品数据 */:
|
|
21
|
-
case "\u56FE\u96C6\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.图集作品数据 */:
|
|
21
|
+
case "\u56FE\u96C6\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.图集作品数据 */: {
|
|
22
22
|
this.URL = DouyinAPI.视频或图集({ aweme_id: data.aweme_id });
|
|
23
23
|
const VideoData = await this.GlobalGetData({
|
|
24
24
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
@@ -26,21 +26,24 @@ export default class DouyinData {
|
|
|
26
26
|
headers: this.headers
|
|
27
27
|
});
|
|
28
28
|
return VideoData;
|
|
29
|
-
|
|
29
|
+
}
|
|
30
|
+
case "\u8BC4\u8BBA\u6570\u636E" /* DouyinDataType.评论数据 */: {
|
|
30
31
|
this.URL = DouyinAPI.评论({ aweme_id: data.aweme_id });
|
|
31
32
|
const CommentsData = await this.GlobalGetData({
|
|
32
33
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
33
34
|
headers: this.headers
|
|
34
35
|
});
|
|
35
36
|
return CommentsData;
|
|
36
|
-
|
|
37
|
+
}
|
|
38
|
+
case "\u4E8C\u7EA7\u8BC4\u8BBA\u6570\u636E" /* DouyinDataType.二级评论数据 */: {
|
|
37
39
|
this.URL = DouyinAPI.二级评论({ aweme_id: data.aweme_id, comment_id: data.comment_id });
|
|
38
40
|
const CommentReplyData = await this.GlobalGetData({
|
|
39
41
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
40
42
|
headers: this.headers
|
|
41
43
|
});
|
|
42
44
|
return CommentReplyData;
|
|
43
|
-
|
|
45
|
+
}
|
|
46
|
+
case "\u7528\u6237\u4E3B\u9875\u6570\u636E" /* DouyinDataType.用户主页数据 */: {
|
|
44
47
|
this.URL = DouyinAPI.用户主页信息({ sec_uid: data.sec_uid });
|
|
45
48
|
const UserInfoData = await this.GlobalGetData({
|
|
46
49
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
@@ -50,14 +53,16 @@ export default class DouyinData {
|
|
|
50
53
|
}
|
|
51
54
|
});
|
|
52
55
|
return UserInfoData;
|
|
53
|
-
|
|
56
|
+
}
|
|
57
|
+
case "\u5B98\u65B9emoji\u6570\u636E" /* DouyinDataType.官方emoji数据 */: {
|
|
54
58
|
this.URL = DouyinAPI.表情();
|
|
55
59
|
const EmojiData = await this.GlobalGetData({
|
|
56
60
|
url: this.URL,
|
|
57
61
|
headers: this.headers
|
|
58
62
|
});
|
|
59
63
|
return EmojiData;
|
|
60
|
-
|
|
64
|
+
}
|
|
65
|
+
case "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E" /* DouyinDataType.用户主页视频列表数据 */: {
|
|
61
66
|
this.URL = DouyinAPI.用户主页视频({ sec_uid: data.sec_uid });
|
|
62
67
|
const UserVideoListData = await this.GlobalGetData({
|
|
63
68
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
@@ -67,7 +72,8 @@ export default class DouyinData {
|
|
|
67
72
|
}
|
|
68
73
|
});
|
|
69
74
|
return UserVideoListData;
|
|
70
|
-
|
|
75
|
+
}
|
|
76
|
+
case "\u70ED\u70B9\u8BCD\u6570\u636E" /* DouyinDataType.热点词数据 */: {
|
|
71
77
|
this.URL = DouyinAPI.热点词({ query: data.query });
|
|
72
78
|
const SuggestWordsData = await this.GlobalGetData({
|
|
73
79
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
@@ -77,7 +83,8 @@ export default class DouyinData {
|
|
|
77
83
|
}
|
|
78
84
|
});
|
|
79
85
|
return SuggestWordsData;
|
|
80
|
-
|
|
86
|
+
}
|
|
87
|
+
case "\u641C\u7D22\u6570\u636E" /* DouyinDataType.搜索数据 */: {
|
|
81
88
|
this.URL = DouyinAPI.搜索({ query: data.query });
|
|
82
89
|
const SearchData = await this.GlobalGetData({
|
|
83
90
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
@@ -87,27 +94,31 @@ export default class DouyinData {
|
|
|
87
94
|
}
|
|
88
95
|
});
|
|
89
96
|
return SearchData;
|
|
90
|
-
|
|
97
|
+
}
|
|
98
|
+
case "\u52A8\u6001\u8868\u60C5\u6570\u636E" /* DouyinDataType.动态表情数据 */: {
|
|
91
99
|
this.URL = DouyinAPI.互动表情();
|
|
92
100
|
const ExpressionPlusData = await this.GlobalGetData({
|
|
93
101
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
94
102
|
headers: this.headers
|
|
95
103
|
});
|
|
96
104
|
return ExpressionPlusData;
|
|
97
|
-
|
|
105
|
+
}
|
|
106
|
+
case "\u97F3\u4E50\u6570\u636E" /* DouyinDataType.音乐数据 */: {
|
|
98
107
|
this.URL = DouyinAPI.背景音乐({ music_id: data.music_id });
|
|
99
108
|
const MusicData = await this.GlobalGetData({
|
|
100
109
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
101
110
|
headers: this.headers
|
|
102
111
|
});
|
|
103
112
|
return MusicData;
|
|
104
|
-
|
|
113
|
+
}
|
|
114
|
+
case "\u5B9E\u51B5\u56FE\u7247\u56FE\u96C6\u6570\u636E" /* DouyinDataType.实况图片图集数据 */: {
|
|
105
115
|
this.URL = DouyinAPI.动图({ aweme_id: data.aweme_id });
|
|
106
116
|
const LiveImages = await this.GlobalGetData({
|
|
107
117
|
url: `${this.URL}&a_bogus=${Sign.AB(this.URL)}`,
|
|
108
118
|
headers: this.headers
|
|
109
119
|
});
|
|
110
120
|
return LiveImages;
|
|
121
|
+
}
|
|
111
122
|
default:
|
|
112
123
|
break;
|
|
113
124
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DouyinDataType, DouyinOptionsType, GetDataResponseType } from '../../types/index.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface resultParams {
|
|
3
|
+
/** 请求数据的类型 */
|
|
4
|
+
type: keyof typeof DouyinDataType;
|
|
5
|
+
/** B站用户ck */
|
|
4
6
|
cookie: string;
|
|
5
|
-
returndata: boolean;
|
|
6
|
-
constructor(type: DouyinDataType, cookie: string, returndata?: boolean);
|
|
7
|
-
result(options?: DouyinOptionsType): Promise<GetDataResponseType>;
|
|
8
7
|
}
|
|
8
|
+
export default function DouyinResult(config?: resultParams, options?: DouyinOptionsType): Promise<GetDataResponseType>;
|
|
9
|
+
export {};
|
|
@@ -1,46 +1,33 @@
|
|
|
1
1
|
import { DouyinData, GetDouyinID } from '../../business/douyin/index.js';
|
|
2
|
-
export default
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case "\u5B9E\u51B5\u56FE\u7247\u56FE\u96C6\u6570\u636E" /* DouyinDataType.实况图片图集数据 */:
|
|
24
|
-
result = await new DouyinData(this.type, this.cookie).GetData(options);
|
|
25
|
-
break;
|
|
26
|
-
case "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.单个视频作品数据 */:
|
|
27
|
-
case "\u56FE\u96C6\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.图集作品数据 */:
|
|
28
|
-
case "\u8BC4\u8BBA\u6570\u636E" /* DouyinDataType.评论数据 */: {
|
|
29
|
-
const defurl = options?.url?.toString().match(/(http|https):\/\/.*\.(douyin|iesdouyin)\.com\/[^ ]+/g);
|
|
30
|
-
const iddata = await GetDouyinID(String(defurl));
|
|
31
|
-
result = await new DouyinData(this.type, this.cookie).GetData(iddata);
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
default:
|
|
35
|
-
result = '';
|
|
36
|
-
break;
|
|
2
|
+
export default async function DouyinResult(config = { cookie: '' }, options = {}) {
|
|
3
|
+
let result;
|
|
4
|
+
switch (config.type) {
|
|
5
|
+
case "\u4E8C\u7EA7\u8BC4\u8BBA\u6570\u636E" /* DouyinDataType.二级评论数据 */:
|
|
6
|
+
case "\u7528\u6237\u4E3B\u9875\u6570\u636E" /* DouyinDataType.用户主页数据 */:
|
|
7
|
+
case "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E" /* DouyinDataType.用户主页视频列表数据 */:
|
|
8
|
+
case "\u70ED\u70B9\u8BCD\u6570\u636E" /* DouyinDataType.热点词数据 */:
|
|
9
|
+
case "\u641C\u7D22\u6570\u636E" /* DouyinDataType.搜索数据 */:
|
|
10
|
+
case "\u5B98\u65B9emoji\u6570\u636E" /* DouyinDataType.官方emoji数据 */:
|
|
11
|
+
case "\u52A8\u6001\u8868\u60C5\u6570\u636E" /* DouyinDataType.动态表情数据 */:
|
|
12
|
+
case "\u97F3\u4E50\u6570\u636E" /* DouyinDataType.音乐数据 */:
|
|
13
|
+
case "\u5B9E\u51B5\u56FE\u7247\u56FE\u96C6\u6570\u636E" /* DouyinDataType.实况图片图集数据 */:
|
|
14
|
+
result = await new DouyinData(config.type, config.cookie).GetData(options);
|
|
15
|
+
break;
|
|
16
|
+
case "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.单个视频作品数据 */:
|
|
17
|
+
case "\u56FE\u96C6\u4F5C\u54C1\u6570\u636E" /* DouyinDataType.图集作品数据 */:
|
|
18
|
+
case "\u8BC4\u8BBA\u6570\u636E" /* DouyinDataType.评论数据 */: {
|
|
19
|
+
const defurl = options?.url?.toString().match(/(http|https):\/\/.*\.(douyin|iesdouyin)\.com\/[^ ]+/g);
|
|
20
|
+
const iddata = await GetDouyinID(String(defurl));
|
|
21
|
+
result = await new DouyinData(config.type, config.cookie).GetData(iddata);
|
|
22
|
+
break;
|
|
37
23
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
code: result !== false && result !== '' ? 200 : 503,
|
|
42
|
-
message: result !== false && result !== '' ? 'success' : 'error',
|
|
43
|
-
data: result !== false && result !== '' ? result : null
|
|
44
|
-
};
|
|
24
|
+
default:
|
|
25
|
+
result = '';
|
|
26
|
+
break;
|
|
45
27
|
}
|
|
28
|
+
return {
|
|
29
|
+
code: result !== false && result !== '' ? 200 : 503,
|
|
30
|
+
message: result !== false && result !== '' ? 'success' : 'error',
|
|
31
|
+
data: result !== false && result !== '' ? result : null
|
|
32
|
+
};
|
|
46
33
|
}
|
|
@@ -180,13 +180,13 @@ function result_encrypt(long_str, num) {
|
|
|
180
180
|
s1: 'Dkdpgh4ZKsQB80/Mfvw36XI1R25+WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=',
|
|
181
181
|
s2: 'Dkdpgh4ZKsQB80/Mfvw36XI1R25-WUAlEi7NLboqYTOPuzmFjJnryx9HVGcaStCe=',
|
|
182
182
|
s3: 'ckdp1h4ZKsUB80/Mfvw36XIgR25+WQAlEi7NLboqYTOPuzmFjJnryx9HVGDaStCe',
|
|
183
|
-
s4: 'Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe'
|
|
183
|
+
s4: 'Dkdpgh2ZmsQB80/MfvV36XI1R45-WUAlEixNLwoqYTOPuzKFjJnry79HbGcaStCe'
|
|
184
184
|
};
|
|
185
185
|
const constant = {
|
|
186
186
|
'0': 16515072,
|
|
187
187
|
'1': 258048,
|
|
188
188
|
'2': 4032,
|
|
189
|
-
str: s_obj[num]
|
|
189
|
+
str: s_obj[num]
|
|
190
190
|
};
|
|
191
191
|
let result = '';
|
|
192
192
|
let lound = 0;
|
|
@@ -230,7 +230,7 @@ function gener_random(random, option) {
|
|
|
230
230
|
(random & 255 & 170) | (option[0] & 85), // 163
|
|
231
231
|
(random & 255 & 85) | (option[0] & 170), //87
|
|
232
232
|
((random >> 8) & 255 & 170) | (option[1] & 85), //37
|
|
233
|
-
((random >> 8) & 255 & 85) | (option[1] & 170)
|
|
233
|
+
((random >> 8) & 255 & 85) | (option[1] & 170) //41
|
|
234
234
|
];
|
|
235
235
|
}
|
|
236
236
|
function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suffix = 'cus', Arguments = [0, 1, 14]) {
|
|
@@ -255,19 +255,19 @@ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suff
|
|
|
255
255
|
ddrt: 7,
|
|
256
256
|
paths: {
|
|
257
257
|
include: [{}, {}, {}, {}, {}, {}, {}],
|
|
258
|
-
exclude: []
|
|
258
|
+
exclude: []
|
|
259
259
|
},
|
|
260
260
|
track: {
|
|
261
261
|
mode: 0,
|
|
262
262
|
delay: 300,
|
|
263
|
-
paths: []
|
|
263
|
+
paths: []
|
|
264
264
|
},
|
|
265
265
|
dump: true,
|
|
266
|
-
rpU: ''
|
|
266
|
+
rpU: ''
|
|
267
267
|
},
|
|
268
268
|
16: start_time, // 3次加密开始时间
|
|
269
269
|
18: 44, // 固定
|
|
270
|
-
19: [1, 0, 1, 5]
|
|
270
|
+
19: [1, 0, 1, 5]
|
|
271
271
|
};
|
|
272
272
|
// 3次加密开始时间
|
|
273
273
|
b[20] = (b[16] >> 24) & 255;
|
|
@@ -445,7 +445,7 @@ function generate_rc4_bb_str(url_search_params, user_agent, window_env_str, suff
|
|
|
445
445
|
b[65],
|
|
446
446
|
b[66],
|
|
447
447
|
b[70],
|
|
448
|
-
b[71]
|
|
448
|
+
b[71]
|
|
449
449
|
];
|
|
450
450
|
bb = bb.concat(window_env_list).concat(b[72]);
|
|
451
451
|
return rc4_encrypt(String.fromCharCode.apply(null, bb), String.fromCharCode.apply(null, [121]));
|
package/lib/business/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '../business/bilibili/index.js'
|
|
2
|
-
export * from '../business/douyin/index.js'
|
|
1
|
+
export * from '../business/bilibili/index.js'
|
|
2
|
+
export * from '../business/douyin/index.js'
|
package/lib/business/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from '../business/bilibili/index.js'
|
|
2
|
-
export * from '../business/douyin/index.js'
|
|
1
|
+
export * from '../business/bilibili/index.js'
|
|
2
|
+
export * from '../business/douyin/index.js'
|
package/lib/index.d.ts
CHANGED
|
@@ -4,4 +4,21 @@ export * from "./server/index.js";
|
|
|
4
4
|
export * from "./types/index.js";
|
|
5
5
|
export { amagi as Amagi, amagi as default };
|
|
6
6
|
import { client } from "./server/index.js";
|
|
7
|
+
import { DouyinDataType, DouyinOptionsType, BilibiliDataType, BilibiliOptionsType } from './types/index.js';
|
|
7
8
|
declare const amagi: typeof client;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param type 请求数据类型
|
|
12
|
+
* @param cookie 抖音用户 ck
|
|
13
|
+
* @param options 请求参数,是一个对象
|
|
14
|
+
* @returns 返回接口的原始数据
|
|
15
|
+
*/
|
|
16
|
+
export declare const GetDouyinData: (type: keyof typeof DouyinDataType, cookie?: string, options?: DouyinOptionsType) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param type 请求数据类型
|
|
20
|
+
* @param cookie bilibili 用户 ck
|
|
21
|
+
* @param options 请求参数,是一个对象
|
|
22
|
+
* @returns 返回接口的原始数据
|
|
23
|
+
*/
|
|
24
|
+
export declare const GetBilibiliData: (type: keyof typeof BilibiliDataType, cookie?: string, options?: BilibiliOptionsType) => Promise<any>;
|
package/lib/index.js
CHANGED
|
@@ -3,5 +3,28 @@ export * from "./model/index.js";
|
|
|
3
3
|
export * from "./server/index.js";
|
|
4
4
|
export * from "./types/index.js";
|
|
5
5
|
export { amagi as Amagi, amagi as default };
|
|
6
|
+
import { DouyinResult, BilibiliResult } from './business/index.js';
|
|
6
7
|
import { client } from "./server/index.js";
|
|
7
8
|
const amagi = client;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param type 请求数据类型
|
|
12
|
+
* @param cookie 抖音用户 ck
|
|
13
|
+
* @param options 请求参数,是一个对象
|
|
14
|
+
* @returns 返回接口的原始数据
|
|
15
|
+
*/
|
|
16
|
+
export const GetDouyinData = async (type, cookie = '', options = {}) => {
|
|
17
|
+
const data = await DouyinResult({ type, cookie }, options);
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param type 请求数据类型
|
|
23
|
+
* @param cookie bilibili 用户 ck
|
|
24
|
+
* @param options 请求参数,是一个对象
|
|
25
|
+
* @returns 返回接口的原始数据
|
|
26
|
+
*/
|
|
27
|
+
export const GetBilibiliData = async (type, cookie = '', options = {}) => {
|
|
28
|
+
const data = await BilibiliResult({ type, cookie }, options);
|
|
29
|
+
return data;
|
|
30
|
+
};
|
package/lib/model/dir.d.ts
CHANGED
package/lib/model/dir.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import { fileURLToPath } from 'url'
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
3
|
/** 当前文件的绝对路径 */
|
|
4
|
-
const filePath = fileURLToPath(import.meta.url).replace(/\\/g, '/')
|
|
4
|
+
const filePath = fileURLToPath(import.meta.url).replace(/\\/g, '/')
|
|
5
5
|
/** 插件包绝对路径 */
|
|
6
|
-
const dirPath = path.resolve(filePath, '../../../')
|
|
6
|
+
const dirPath = path.resolve(filePath, '../../../')
|
|
7
7
|
/** 插件包的名称 */
|
|
8
|
-
const basename = path.basename(dirPath)
|
|
9
|
-
export { basename, dirPath }
|
|
8
|
+
const basename = path.basename(dirPath)
|
|
9
|
+
export { basename, dirPath }
|
package/lib/model/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Networks from './networks.js'
|
|
2
|
-
export * from './dir.js'
|
|
3
|
-
export { Networks }
|
|
1
|
+
import Networks from './networks.js'
|
|
2
|
+
export * from './dir.js'
|
|
3
|
+
export { Networks }
|
package/lib/model/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Networks from './networks.js'
|
|
2
|
-
export * from './dir.js'
|
|
3
|
-
export { Networks }
|
|
1
|
+
import Networks from './networks.js'
|
|
2
|
+
export * from './dir.js'
|
|
3
|
+
export { Networks }
|
package/lib/model/networks.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios'
|
|
2
|
-
import { NetworksConfigType } from '../types/index.js'
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios'
|
|
2
|
+
import { NetworksConfigType } from '../types/index.js'
|
|
3
3
|
interface HeadersObject {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
6
6
|
export default class Networks {
|
|
7
|
-
url: string
|
|
8
|
-
method: string
|
|
9
|
-
headers: HeadersObject
|
|
10
|
-
type: string
|
|
11
|
-
body?: any
|
|
12
|
-
axiosInstance: any
|
|
13
|
-
isGetResult: boolean
|
|
14
|
-
timeout: number
|
|
15
|
-
timer: NodeJS.Timeout | undefined
|
|
16
|
-
data: {}
|
|
7
|
+
url: string
|
|
8
|
+
method: string
|
|
9
|
+
headers: HeadersObject
|
|
10
|
+
type: string
|
|
11
|
+
body?: any
|
|
12
|
+
axiosInstance: any
|
|
13
|
+
isGetResult: boolean
|
|
14
|
+
timeout: number
|
|
15
|
+
timer: NodeJS.Timeout | undefined
|
|
16
|
+
data: {}
|
|
17
17
|
constructor(data: NetworksConfigType);
|
|
18
18
|
get config(): AxiosRequestConfig;
|
|
19
19
|
getfetch(): Promise<AxiosResponse | boolean>;
|
|
@@ -24,9 +24,5 @@ export default class Networks {
|
|
|
24
24
|
getLocation(): Promise<string>;
|
|
25
25
|
/** 获取数据并处理数据的格式化,默认json */
|
|
26
26
|
getData(new_fetch?: string): Promise<any | boolean>;
|
|
27
|
-
Tojson(): Promise<any>;
|
|
28
|
-
ToText(): Promise<void>;
|
|
29
|
-
ToArrayBuffer(): Promise<void>;
|
|
30
|
-
ToBlob(): Promise<void>;
|
|
31
27
|
}
|
|
32
|
-
export {}
|
|
28
|
+
export {}
|