@ikenxuan/amagi 4.4.9 → 4.4.11
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 +145 -94
- package/dist/default/cjs/index.cjs +30 -49
- package/dist/default/esm/index.mjs +30 -48
- package/dist/default/index.d.ts +72 -65
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,139 +1,190 @@
|
|
|
1
|
-
# amagi
|
|
1
|
+
# amagi /ˈæmədʒi/ 🎵
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
抖音、bilibili 的 web 端相关数据接口基于 Node.js 的实现。支持最低 node 版本为 v18 🚀
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 我是真爱粉 🧩
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
"amagi" /ˈæmədʒi/ 名称灵感来源于网络流行的"你干嘛~哎呦~"视频,这是由歌手 cxk 的一段采访视频衍生而来的网络文化现象。这个梗在抖音和 bilibili [BV1St41137jm](https://www.bilibili.com/video/BV1St41137jm) 上广泛传播,成为了中国互联网文化的一部分。选择这个名称也象征着本项目与这些平台内容的紧密联系。🎤💃
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
此生必看 [BV1DL411X7jE](https://www.bilibili.com/video/BV1DL411X7jE)
|
|
10
|
+
|
|
11
|
+
## 项目简介 📝
|
|
12
|
+
|
|
13
|
+
本项目最初的代码从 [kkkkkk-10086](https://github.com/ikenxuan/kkkkkk-10086) 抽离。主要负责相关数据接口的封装。
|
|
14
|
+
|
|
15
|
+
amagi 将作为一个独立的上游模块,提供给下游 [karin-plugin-kkk](https://github.com/ikenxuan/karin-plugin-kkk) 和 [kkkkkk-10086](https://github.com/ikenxuan/kkkkkk-10086) 进行视频解析相关业务使用。这两个项目的主要业务基本已经完成,所以如果它们没有什么特殊新业务需求,amagi 大概也不会有新的 API 更新。
|
|
16
|
+
|
|
17
|
+
当然,如果你的下游有新的业务需求,欢迎提 issue 或 pr。(其实作者本人很菜,issue 不一定能解决)
|
|
18
|
+
|
|
19
|
+
## 安装 📦
|
|
20
|
+
|
|
21
|
+
```bash
|
|
10
22
|
pnpm add @ikenxuan/amagi@latest
|
|
11
23
|
```
|
|
12
24
|
|
|
13
|
-
##
|
|
25
|
+
## 默认导出使用方法 🚀
|
|
26
|
+
|
|
27
|
+
### 基本用法 ✨
|
|
14
28
|
|
|
15
|
-
|
|
29
|
+
```javascript
|
|
30
|
+
import Client from '@ikenxuan/amagi'
|
|
16
31
|
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
// 创建客户端实例
|
|
33
|
+
const amagi = new Client({
|
|
34
|
+
douyin: '', // 抖音 cookie(可选)
|
|
35
|
+
bilibili: '', // B站 cookie(可选)
|
|
36
|
+
})
|
|
19
37
|
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
// 使用示例
|
|
39
|
+
async function example() {
|
|
40
|
+
// 获取抖音搜索数据
|
|
41
|
+
const searchData = await amagi.getDouyinData('搜索数据', {
|
|
42
|
+
query: '热门视频',
|
|
43
|
+
number: 10,
|
|
44
|
+
})
|
|
22
45
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
// 获取B站视频数据
|
|
47
|
+
const videoData = await amagi.getBilibiliData('单个视频作品数据', {
|
|
48
|
+
bvid: 'BV1fK4y1q79u',
|
|
49
|
+
})
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.catch((err) => console.error(err))
|
|
51
|
+
console.log(searchData)
|
|
52
|
+
}
|
|
31
53
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
example()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 启动本地 HTTP 服务 🌐
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
import Client from '@ikenxuan/amagi'
|
|
61
|
+
|
|
62
|
+
const amagi = new Client({
|
|
63
|
+
douyin: '你的抖音cookie',
|
|
64
|
+
bilibili: '你的B站cookie',
|
|
42
65
|
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
|
|
67
|
+
// 启动本地服务,默认端口 4567
|
|
68
|
+
const app = amagi.startClient()
|
|
69
|
+
// 或指定端口
|
|
70
|
+
// const app = amagi.startClient(8080)
|
|
47
71
|
```
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
启动后可通过以下路径访问 API:
|
|
50
74
|
|
|
51
|
-
-
|
|
75
|
+
- 抖音 API: `http://localhost:4567/api/douyin/...` 📱
|
|
76
|
+
- bilibili API: `http://localhost:4567/api/bilibili/...` 📺
|
|
52
77
|
|
|
53
|
-
|
|
78
|
+
API 文档: https://amagi.apifox.cn 📝
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
## 平台功能模块 🧩
|
|
56
81
|
|
|
57
|
-
|
|
82
|
+
PS: 以下功能模块的使用方法与上述基本用法类似,我也不知道为什么要写这个。。。
|
|
58
83
|
|
|
59
|
-
|
|
60
|
-
import amagi from '@ikenxuan/amagi'
|
|
84
|
+
### 抖音功能模块 📱
|
|
61
85
|
|
|
62
|
-
|
|
63
|
-
douyin: '你的抖音ck',
|
|
64
|
-
bilibili: '你的B站ck',
|
|
65
|
-
})
|
|
86
|
+
抖音相关功能模块提供了一系列工具和 API 接口,用于获取抖音平台的数据。
|
|
66
87
|
|
|
67
|
-
|
|
68
|
-
|
|
88
|
+
```javascript
|
|
89
|
+
import { douyinUtils } from '@ikenxuan/amagi'
|
|
69
90
|
|
|
70
|
-
|
|
91
|
+
// 使用签名算法
|
|
92
|
+
const mstoken = douyinUtils.sign.Mstoken(107)
|
|
93
|
+
const verifyFp = douyinUtils.sign.VerifyFpManager()
|
|
94
|
+
const abSign = douyinUtils.sign.AB('需要签名的地址')
|
|
71
95
|
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
// 使用 API 接口
|
|
97
|
+
const videoData = await douyinUtils.api.getWorkInfo(
|
|
98
|
+
{
|
|
99
|
+
aweme_id: '视频ID',
|
|
100
|
+
},
|
|
101
|
+
'有效的用户 Cookie'
|
|
102
|
+
)
|
|
76
103
|
|
|
77
|
-
const
|
|
78
|
-
|
|
104
|
+
const userInfo = await douyinUtils.api.getUserProfile(
|
|
105
|
+
{
|
|
106
|
+
sec_uid: '用户ID',
|
|
107
|
+
},
|
|
108
|
+
'有效的用户 Cookie'
|
|
109
|
+
)
|
|
79
110
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
// 或者可以这样
|
|
86
|
-
const instance = amagi({
|
|
87
|
-
douyin: douyinck,
|
|
88
|
-
// ......
|
|
111
|
+
// 直接获取数据
|
|
112
|
+
const searchResult = await douyinUtils.getDouyinData('搜索数据', {
|
|
113
|
+
query: '搜索关键词',
|
|
114
|
+
number: 10,
|
|
89
115
|
})
|
|
116
|
+
```
|
|
90
117
|
|
|
91
|
-
|
|
92
|
-
instance.startClient(6666)
|
|
118
|
+
主要功能:
|
|
93
119
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
120
|
+
- 📹 视频/图集作品数据获取
|
|
121
|
+
- 👤 用户信息获取
|
|
122
|
+
- 💬 评论数据获取
|
|
123
|
+
- 🔍 搜索功能
|
|
124
|
+
- 🎬 直播间信息
|
|
125
|
+
- 🎵 音乐数据
|
|
126
|
+
- 😄 表情数据
|
|
99
127
|
|
|
100
|
-
|
|
101
|
-
getBilibiliData('单个视频作品数据', bilibilick, { bvid: 'BV1Nx4y147n3' })
|
|
102
|
-
.then((data) => console.log('B站' + data))
|
|
103
|
-
.catch((err) => console.error(err))
|
|
104
|
-
```
|
|
128
|
+
### bilibili 功能模块 📺
|
|
105
129
|
|
|
106
|
-
|
|
130
|
+
bilibili 相关功能模块提供了获取 bilibili 平台数据的工具和 API。
|
|
107
131
|
|
|
108
|
-
|
|
132
|
+
```javascript
|
|
133
|
+
import { bilibiliUtils } from '@ikenxuan/amagi'
|
|
109
134
|
|
|
110
|
-
|
|
111
|
-
|
|
135
|
+
// 获取视频信息
|
|
136
|
+
const videoInfo = await bilibiliUtils.api.getVideoInfo({
|
|
137
|
+
bvid: 'BV1fK4y1q79u',
|
|
138
|
+
})
|
|
112
139
|
|
|
113
|
-
|
|
114
|
-
|
|
140
|
+
// 获取评论数据
|
|
141
|
+
const comments = await bilibiliUtils.api.getComments({
|
|
142
|
+
oid: 111111, // 稿件ID,也就是AV号去除前缀后的内容
|
|
143
|
+
type: 1,
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// 直接获取数据
|
|
147
|
+
const userInfo = await bilibiliUtils.getBilibiliData('用户主页数据', {
|
|
148
|
+
host_mid: 1340190821, // 用户ID
|
|
149
|
+
})
|
|
115
150
|
```
|
|
116
151
|
|
|
117
|
-
|
|
152
|
+
主要功能:
|
|
118
153
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
154
|
+
- 📹 视频信息获取
|
|
155
|
+
- 💬 评论数据获取
|
|
156
|
+
- 👤 用户信息获取
|
|
157
|
+
- 🎬 番剧信息获取
|
|
158
|
+
- 📡 直播间信息
|
|
159
|
+
- 📊 动态数据获取
|
|
160
|
+
- 🔄 AV/BV 号转换
|
|
161
|
+
|
|
162
|
+
## 类型支持 🧰
|
|
163
|
+
|
|
164
|
+
该库提供完整的 TypeScript 类型支持,可以获得良好的代码提示和类型检查。✅
|
|
165
|
+
|
|
166
|
+
## 许可证 📜
|
|
167
|
+
|
|
168
|
+
[GPL-3.0](https://github.com/ikenxuan/amagi/blob/main/LICENSE) ⚖️
|
|
122
169
|
|
|
123
|
-
##
|
|
170
|
+
## 免责声明 ⚠️
|
|
124
171
|
|
|
125
|
-
|
|
172
|
+
- ⭐ 这个项目免费开源,不存在收费。
|
|
173
|
+
- 🛡️ 本项目的作者不承担任何责任,包括但不限于因使用本项目而导致的任何损失或损害。
|
|
174
|
+
- 📚 本项目仅供学习和研究使用,不得用于任何商业目的。
|
|
175
|
+
- 🔒 本项目的作者不对因使用本项目而产生的任何后果负责。
|
|
176
|
+
- 📝 本项目的使用者在下载、安装、运行或使用本工具时,即表示已阅读并同意本免责声明。如有异议,请立即停止使用本工具,并删除所有相关文件。
|
|
177
|
+
- 🔄 本项目的作者保留随时修改、更新、删除或终止本工具的权利,无需事先通知或承担任何义务。
|
|
126
178
|
|
|
127
|
-
|
|
179
|
+
🔐 本仓库没有后门,本仓库不会上传有关你的任何信息到第三方。
|
|
128
180
|
|
|
129
|
-
|
|
130
|
-
所配置的 ck 只会用于请求官方 API 接口
|
|
181
|
+
🍪 所传递的用户 cookies 只会用于请求官方 API 接口
|
|
131
182
|
|
|
132
|
-
|
|
183
|
+
## 鸣谢 🙏
|
|
133
184
|
|
|
134
|
-
|
|
185
|
+
amagi 的诞生参考了以下开源项目:
|
|
135
186
|
|
|
136
|
-
- [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
|
137
|
-
- [NearHuiwen/TiktokDouyinCrawler](https://github.com/NearHuiwen/TiktokDouyinCrawler)
|
|
138
|
-
- [Evil0ctal/Douyin_TikTok_Download_API](https://github.com/Evil0ctal/Douyin_TikTok_Download_API)
|
|
139
|
-
- [Johnserf-Seed/f2](https://github.com/Johnserf-Seed/f2)
|
|
187
|
+
- 🎬 [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
|
188
|
+
- 📱 [NearHuiwen/TiktokDouyinCrawler](https://github.com/NearHuiwen/TiktokDouyinCrawler)
|
|
189
|
+
- 📥 [Evil0ctal/Douyin_TikTok_Download_API](https://github.com/Evil0ctal/Douyin_TikTok_Download_API)
|
|
190
|
+
- 🔄 [Johnserf-Seed/f2](https://github.com/Johnserf-Seed/f2)
|
|
@@ -1270,13 +1270,21 @@ var headers = {
|
|
|
1270
1270
|
"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"
|
|
1271
1271
|
};
|
|
1272
1272
|
var douyinSign = class {
|
|
1273
|
-
/**
|
|
1273
|
+
/**
|
|
1274
|
+
* 生成一个指定长度的随机字符串
|
|
1275
|
+
* @param length 字符串长度,默认为116
|
|
1276
|
+
* @returns
|
|
1277
|
+
*/
|
|
1274
1278
|
static Mstoken(length) {
|
|
1275
1279
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1276
|
-
const randomBytes = crypto__default.default.randomBytes(length);
|
|
1280
|
+
const randomBytes = crypto__default.default.randomBytes(length ?? 116);
|
|
1277
1281
|
return Array.from(randomBytes, (byte) => characters[byte % characters.length]).join("");
|
|
1278
1282
|
}
|
|
1279
|
-
/**
|
|
1283
|
+
/**
|
|
1284
|
+
* a_bogus 签名算法
|
|
1285
|
+
* @param url 需要签名的地址
|
|
1286
|
+
* @returns 对此地址签名后的URL查询参数
|
|
1287
|
+
*/
|
|
1280
1288
|
static AB(url) {
|
|
1281
1289
|
return a_bogus_default(url, headers["User-Agent"]);
|
|
1282
1290
|
}
|
|
@@ -2370,10 +2378,10 @@ var amagiClient = class {
|
|
|
2370
2378
|
*
|
|
2371
2379
|
* @param cookie - 包含抖音ck、B站ck、快手ck的对象
|
|
2372
2380
|
*/
|
|
2373
|
-
constructor(
|
|
2374
|
-
this.douyin = (
|
|
2375
|
-
this.bilibili = (
|
|
2376
|
-
this.kuaishou = (
|
|
2381
|
+
constructor(options) {
|
|
2382
|
+
this.douyin = (options == null ? void 0 : options.douyin) ?? "";
|
|
2383
|
+
this.bilibili = (options == null ? void 0 : options.bilibili) ?? "";
|
|
2384
|
+
this.kuaishou = (options == null ? void 0 : options.kuaishou) ?? "";
|
|
2377
2385
|
}
|
|
2378
2386
|
/**
|
|
2379
2387
|
* 启动本地 HTTP 服务
|
|
@@ -2403,18 +2411,6 @@ var amagiClient = class {
|
|
|
2403
2411
|
* @param type - 请求数据类型
|
|
2404
2412
|
* @param options - 请求参数,是一个对象
|
|
2405
2413
|
* @returns 返回接口的原始数据
|
|
2406
|
-
* @example
|
|
2407
|
-
* ```ts
|
|
2408
|
-
* import Client from '@ikenxuan/amagi'
|
|
2409
|
-
*
|
|
2410
|
-
* const amagi = new Client({
|
|
2411
|
-
* douyin: '' // 有效的抖音ck
|
|
2412
|
-
* })
|
|
2413
|
-
* const data = await amagi.getDouyinData('搜索数据', {
|
|
2414
|
-
* query: '114514',
|
|
2415
|
-
* number: 10
|
|
2416
|
-
* })
|
|
2417
|
-
* ```
|
|
2418
2414
|
*/
|
|
2419
2415
|
getDouyinData = async (methodType, options) => {
|
|
2420
2416
|
const fullOptions = {
|
|
@@ -2428,17 +2424,6 @@ var amagiClient = class {
|
|
|
2428
2424
|
* @param type - 请求数据类型
|
|
2429
2425
|
* @param options - 请求参数,是一个对象
|
|
2430
2426
|
* @returns 返回接口的原始数据
|
|
2431
|
-
* @example
|
|
2432
|
-
* ```ts
|
|
2433
|
-
* import Client from '@ikenxuan/amagi'
|
|
2434
|
-
*
|
|
2435
|
-
* const amagi = new Client({
|
|
2436
|
-
* bilibili: '' // 有效的B站ck
|
|
2437
|
-
* })
|
|
2438
|
-
* const data = await amagi.getBilibiliData('单个视频作品数据', {
|
|
2439
|
-
* bvid: 'BV1fK4y1q79u'
|
|
2440
|
-
* })
|
|
2441
|
-
* ```
|
|
2442
2427
|
*/
|
|
2443
2428
|
getBilibiliData = async (methodType, options) => {
|
|
2444
2429
|
const fullOptions = {
|
|
@@ -2452,17 +2437,6 @@ var amagiClient = class {
|
|
|
2452
2437
|
* @param type - 请求数据类型
|
|
2453
2438
|
* @param options - 请求参数,是一个对象
|
|
2454
2439
|
* @returns 返回接口的原始数据
|
|
2455
|
-
* @example
|
|
2456
|
-
* ```ts
|
|
2457
|
-
* import Client from '@ikenxuan/amagi'
|
|
2458
|
-
*
|
|
2459
|
-
* const amagi = new Client({
|
|
2460
|
-
* kuaishou: '' // 有效的快手ck
|
|
2461
|
-
* })
|
|
2462
|
-
* const data = await amagi.getKuaishouData('单个视频作品数据', {
|
|
2463
|
-
* photoId: '3xdpv6sfi8yjsqy'
|
|
2464
|
-
* })
|
|
2465
|
-
* ```
|
|
2466
2440
|
*/
|
|
2467
2441
|
getKuaishouData = async (methodType, options) => {
|
|
2468
2442
|
const fullOptions = {
|
|
@@ -2474,15 +2448,22 @@ var amagiClient = class {
|
|
|
2474
2448
|
};
|
|
2475
2449
|
|
|
2476
2450
|
// src/index.ts
|
|
2477
|
-
var
|
|
2478
|
-
function amagi(options) {
|
|
2479
|
-
return new amagiClient(options);
|
|
2480
|
-
}
|
|
2481
|
-
function Amagi(options) {
|
|
2451
|
+
var createAmagiClient = (options) => {
|
|
2482
2452
|
return new amagiClient(options);
|
|
2483
|
-
}
|
|
2453
|
+
};
|
|
2454
|
+
var amagi = Object.assign(
|
|
2455
|
+
createAmagiClient,
|
|
2456
|
+
{
|
|
2457
|
+
/** 抖音相关功能模块 (工具集) */
|
|
2458
|
+
douyin: douyinUtils,
|
|
2459
|
+
/** B站相关功能模块 (工具集) */
|
|
2460
|
+
bilibili: bilibiliUtils,
|
|
2461
|
+
/** 快手相关功能模块 (工具集) */
|
|
2462
|
+
kuaishou: kuaishouUtils
|
|
2463
|
+
}
|
|
2464
|
+
);
|
|
2465
|
+
var Client = amagi;
|
|
2484
2466
|
|
|
2485
|
-
exports.Amagi = Amagi;
|
|
2486
2467
|
exports.BilibiliValidateData = BilibiliValidateData;
|
|
2487
2468
|
exports.DouyinValidateData = DouyinValidateData;
|
|
2488
2469
|
exports.KuaishouAPI = KuaishouAPI;
|
|
@@ -2496,7 +2477,7 @@ exports.bilibiliAPI = bilibiliAPI;
|
|
|
2496
2477
|
exports.bilibiliApiUrls = bilibiliApiUrls;
|
|
2497
2478
|
exports.bilibiliUtils = bilibiliUtils;
|
|
2498
2479
|
exports.bv2av = bv2av;
|
|
2499
|
-
exports.default =
|
|
2480
|
+
exports.default = Client;
|
|
2500
2481
|
exports.douyin = douyin;
|
|
2501
2482
|
exports.douyinAPI = douyinAPI;
|
|
2502
2483
|
exports.douyinApiUrls = douyinApiUrls;
|
|
@@ -1258,13 +1258,21 @@ var headers = {
|
|
|
1258
1258
|
"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"
|
|
1259
1259
|
};
|
|
1260
1260
|
var douyinSign = class {
|
|
1261
|
-
/**
|
|
1261
|
+
/**
|
|
1262
|
+
* 生成一个指定长度的随机字符串
|
|
1263
|
+
* @param length 字符串长度,默认为116
|
|
1264
|
+
* @returns
|
|
1265
|
+
*/
|
|
1262
1266
|
static Mstoken(length) {
|
|
1263
1267
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1264
|
-
const randomBytes = crypto.randomBytes(length);
|
|
1268
|
+
const randomBytes = crypto.randomBytes(length ?? 116);
|
|
1265
1269
|
return Array.from(randomBytes, (byte) => characters[byte % characters.length]).join("");
|
|
1266
1270
|
}
|
|
1267
|
-
/**
|
|
1271
|
+
/**
|
|
1272
|
+
* a_bogus 签名算法
|
|
1273
|
+
* @param url 需要签名的地址
|
|
1274
|
+
* @returns 对此地址签名后的URL查询参数
|
|
1275
|
+
*/
|
|
1268
1276
|
static AB(url) {
|
|
1269
1277
|
return a_bogus_default(url, headers["User-Agent"]);
|
|
1270
1278
|
}
|
|
@@ -2358,10 +2366,10 @@ var amagiClient = class {
|
|
|
2358
2366
|
*
|
|
2359
2367
|
* @param cookie - 包含抖音ck、B站ck、快手ck的对象
|
|
2360
2368
|
*/
|
|
2361
|
-
constructor(
|
|
2362
|
-
this.douyin = (
|
|
2363
|
-
this.bilibili = (
|
|
2364
|
-
this.kuaishou = (
|
|
2369
|
+
constructor(options) {
|
|
2370
|
+
this.douyin = (options == null ? void 0 : options.douyin) ?? "";
|
|
2371
|
+
this.bilibili = (options == null ? void 0 : options.bilibili) ?? "";
|
|
2372
|
+
this.kuaishou = (options == null ? void 0 : options.kuaishou) ?? "";
|
|
2365
2373
|
}
|
|
2366
2374
|
/**
|
|
2367
2375
|
* 启动本地 HTTP 服务
|
|
@@ -2391,18 +2399,6 @@ var amagiClient = class {
|
|
|
2391
2399
|
* @param type - 请求数据类型
|
|
2392
2400
|
* @param options - 请求参数,是一个对象
|
|
2393
2401
|
* @returns 返回接口的原始数据
|
|
2394
|
-
* @example
|
|
2395
|
-
* ```ts
|
|
2396
|
-
* import Client from '@ikenxuan/amagi'
|
|
2397
|
-
*
|
|
2398
|
-
* const amagi = new Client({
|
|
2399
|
-
* douyin: '' // 有效的抖音ck
|
|
2400
|
-
* })
|
|
2401
|
-
* const data = await amagi.getDouyinData('搜索数据', {
|
|
2402
|
-
* query: '114514',
|
|
2403
|
-
* number: 10
|
|
2404
|
-
* })
|
|
2405
|
-
* ```
|
|
2406
2402
|
*/
|
|
2407
2403
|
getDouyinData = async (methodType, options) => {
|
|
2408
2404
|
const fullOptions = {
|
|
@@ -2416,17 +2412,6 @@ var amagiClient = class {
|
|
|
2416
2412
|
* @param type - 请求数据类型
|
|
2417
2413
|
* @param options - 请求参数,是一个对象
|
|
2418
2414
|
* @returns 返回接口的原始数据
|
|
2419
|
-
* @example
|
|
2420
|
-
* ```ts
|
|
2421
|
-
* import Client from '@ikenxuan/amagi'
|
|
2422
|
-
*
|
|
2423
|
-
* const amagi = new Client({
|
|
2424
|
-
* bilibili: '' // 有效的B站ck
|
|
2425
|
-
* })
|
|
2426
|
-
* const data = await amagi.getBilibiliData('单个视频作品数据', {
|
|
2427
|
-
* bvid: 'BV1fK4y1q79u'
|
|
2428
|
-
* })
|
|
2429
|
-
* ```
|
|
2430
2415
|
*/
|
|
2431
2416
|
getBilibiliData = async (methodType, options) => {
|
|
2432
2417
|
const fullOptions = {
|
|
@@ -2440,17 +2425,6 @@ var amagiClient = class {
|
|
|
2440
2425
|
* @param type - 请求数据类型
|
|
2441
2426
|
* @param options - 请求参数,是一个对象
|
|
2442
2427
|
* @returns 返回接口的原始数据
|
|
2443
|
-
* @example
|
|
2444
|
-
* ```ts
|
|
2445
|
-
* import Client from '@ikenxuan/amagi'
|
|
2446
|
-
*
|
|
2447
|
-
* const amagi = new Client({
|
|
2448
|
-
* kuaishou: '' // 有效的快手ck
|
|
2449
|
-
* })
|
|
2450
|
-
* const data = await amagi.getKuaishouData('单个视频作品数据', {
|
|
2451
|
-
* photoId: '3xdpv6sfi8yjsqy'
|
|
2452
|
-
* })
|
|
2453
|
-
* ```
|
|
2454
2428
|
*/
|
|
2455
2429
|
getKuaishouData = async (methodType, options) => {
|
|
2456
2430
|
const fullOptions = {
|
|
@@ -2462,12 +2436,20 @@ var amagiClient = class {
|
|
|
2462
2436
|
};
|
|
2463
2437
|
|
|
2464
2438
|
// src/index.ts
|
|
2465
|
-
var
|
|
2466
|
-
function amagi(options) {
|
|
2467
|
-
return new amagiClient(options);
|
|
2468
|
-
}
|
|
2469
|
-
function Amagi(options) {
|
|
2439
|
+
var createAmagiClient = (options) => {
|
|
2470
2440
|
return new amagiClient(options);
|
|
2471
|
-
}
|
|
2441
|
+
};
|
|
2442
|
+
var amagi = Object.assign(
|
|
2443
|
+
createAmagiClient,
|
|
2444
|
+
{
|
|
2445
|
+
/** 抖音相关功能模块 (工具集) */
|
|
2446
|
+
douyin: douyinUtils,
|
|
2447
|
+
/** B站相关功能模块 (工具集) */
|
|
2448
|
+
bilibili: bilibiliUtils,
|
|
2449
|
+
/** 快手相关功能模块 (工具集) */
|
|
2450
|
+
kuaishou: kuaishouUtils
|
|
2451
|
+
}
|
|
2452
|
+
);
|
|
2453
|
+
var Client = amagi;
|
|
2472
2454
|
|
|
2473
|
-
export {
|
|
2455
|
+
export { BilibiliValidateData, DouyinValidateData, KuaishouAPI, KusiahouValidateData, Networks, amagi, amagiClient, av2bv, bilibili, bilibiliAPI, bilibiliApiUrls, bilibiliUtils, bv2av, Client as default, douyin, douyinAPI, douyinApiUrls, douyinSign, douyinUtils, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, kuaishou, kuaishouAPI, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, wbi_sign };
|
package/dist/default/index.d.ts
CHANGED
|
@@ -13239,19 +13239,6 @@ type TypeControl = {
|
|
|
13239
13239
|
* - `loose` 或 `未指定`: 返回宽松的 any 类型(默认)
|
|
13240
13240
|
*
|
|
13241
13241
|
* @default 'loose'
|
|
13242
|
-
* @example
|
|
13243
|
-
* ```ts
|
|
13244
|
-
* // 严格模式
|
|
13245
|
-
* const data = await amagi.getDouyinData('视频作品数据', {
|
|
13246
|
-
* aweme_id: '123',
|
|
13247
|
-
* typeMode: 'strict' // 返回精确的 VideoWork 类型
|
|
13248
|
-
* });
|
|
13249
|
-
*
|
|
13250
|
-
* // 宽松模式
|
|
13251
|
-
* const data = await amagi.getDouyinData('视频作品数据', {
|
|
13252
|
-
* aweme_id: '123' // 返回 any 类型
|
|
13253
|
-
* });
|
|
13254
|
-
* ```
|
|
13255
13242
|
*/
|
|
13256
13243
|
typeMode?: 'strict' | 'loose';
|
|
13257
13244
|
};
|
|
@@ -13820,9 +13807,17 @@ declare const douyinAPI: DouyinAPI;
|
|
|
13820
13807
|
declare const douyinApiUrls: DouyinAPI;
|
|
13821
13808
|
|
|
13822
13809
|
declare class douyinSign {
|
|
13823
|
-
/**
|
|
13810
|
+
/**
|
|
13811
|
+
* 生成一个指定长度的随机字符串
|
|
13812
|
+
* @param length 字符串长度,默认为116
|
|
13813
|
+
* @returns
|
|
13814
|
+
*/
|
|
13824
13815
|
static Mstoken(length: number): string;
|
|
13825
|
-
/**
|
|
13816
|
+
/**
|
|
13817
|
+
* a_bogus 签名算法
|
|
13818
|
+
* @param url 需要签名的地址
|
|
13819
|
+
* @returns 对此地址签名后的URL查询参数
|
|
13820
|
+
*/
|
|
13826
13821
|
static AB(url: string): string;
|
|
13827
13822
|
/** 生成一个唯一的验证字符串 */
|
|
13828
13823
|
static VerifyFpManager(): string;
|
|
@@ -13996,7 +13991,7 @@ type kuaishouUtilsModel = {
|
|
|
13996
13991
|
/** 快手相关功能模块 (工具集) */
|
|
13997
13992
|
declare const kuaishouUtils: kuaishouUtilsModel;
|
|
13998
13993
|
|
|
13999
|
-
type
|
|
13994
|
+
type cookiesOptions = {
|
|
14000
13995
|
/**
|
|
14001
13996
|
* 抖音ck
|
|
14002
13997
|
* @defaultValue ''
|
|
@@ -14021,7 +14016,7 @@ declare class amagiClient {
|
|
|
14021
14016
|
*
|
|
14022
14017
|
* @param cookie - 包含抖音ck、B站ck、快手ck的对象
|
|
14023
14018
|
*/
|
|
14024
|
-
constructor(
|
|
14019
|
+
constructor(options: cookiesOptions);
|
|
14025
14020
|
/**
|
|
14026
14021
|
* 启动本地 HTTP 服务
|
|
14027
14022
|
* @param port - 监听端口
|
|
@@ -14034,18 +14029,6 @@ declare class amagiClient {
|
|
|
14034
14029
|
* @param type - 请求数据类型
|
|
14035
14030
|
* @param options - 请求参数,是一个对象
|
|
14036
14031
|
* @returns 返回接口的原始数据
|
|
14037
|
-
* @example
|
|
14038
|
-
* ```ts
|
|
14039
|
-
* import Client from '@ikenxuan/amagi'
|
|
14040
|
-
*
|
|
14041
|
-
* const amagi = new Client({
|
|
14042
|
-
* douyin: '' // 有效的抖音ck
|
|
14043
|
-
* })
|
|
14044
|
-
* const data = await amagi.getDouyinData('搜索数据', {
|
|
14045
|
-
* query: '114514',
|
|
14046
|
-
* number: 10
|
|
14047
|
-
* })
|
|
14048
|
-
* ```
|
|
14049
14032
|
*/
|
|
14050
14033
|
getDouyinData: <T extends keyof DouyinDataOptionsMap, R extends "strict" | "loose">(methodType: T, options?: DouyinDataOptions<T> & {
|
|
14051
14034
|
typeMode?: R;
|
|
@@ -14055,17 +14038,6 @@ declare class amagiClient {
|
|
|
14055
14038
|
* @param type - 请求数据类型
|
|
14056
14039
|
* @param options - 请求参数,是一个对象
|
|
14057
14040
|
* @returns 返回接口的原始数据
|
|
14058
|
-
* @example
|
|
14059
|
-
* ```ts
|
|
14060
|
-
* import Client from '@ikenxuan/amagi'
|
|
14061
|
-
*
|
|
14062
|
-
* const amagi = new Client({
|
|
14063
|
-
* bilibili: '' // 有效的B站ck
|
|
14064
|
-
* })
|
|
14065
|
-
* const data = await amagi.getBilibiliData('单个视频作品数据', {
|
|
14066
|
-
* bvid: 'BV1fK4y1q79u'
|
|
14067
|
-
* })
|
|
14068
|
-
* ```
|
|
14069
14041
|
*/
|
|
14070
14042
|
getBilibiliData: <T extends keyof BilibiliDataOptionsMap, R extends "strict" | "loose">(methodType: T, options?: BilibiliDataOptions<T> & {
|
|
14071
14043
|
typeMode?: R;
|
|
@@ -14075,35 +14047,70 @@ declare class amagiClient {
|
|
|
14075
14047
|
* @param type - 请求数据类型
|
|
14076
14048
|
* @param options - 请求参数,是一个对象
|
|
14077
14049
|
* @returns 返回接口的原始数据
|
|
14078
|
-
* @example
|
|
14079
|
-
* ```ts
|
|
14080
|
-
* import Client from '@ikenxuan/amagi'
|
|
14081
|
-
*
|
|
14082
|
-
* const amagi = new Client({
|
|
14083
|
-
* kuaishou: '' // 有效的快手ck
|
|
14084
|
-
* })
|
|
14085
|
-
* const data = await amagi.getKuaishouData('单个视频作品数据', {
|
|
14086
|
-
* photoId: '3xdpv6sfi8yjsqy'
|
|
14087
|
-
* })
|
|
14088
|
-
* ```
|
|
14089
14050
|
*/
|
|
14090
14051
|
getKuaishouData: <T extends keyof KuaishouDataOptionsMap, R extends "strict" | "loose">(methodType: T, options?: KuaishouDataOptions<T> & {
|
|
14091
14052
|
typeMode?: R;
|
|
14092
14053
|
}) => Promise<R extends "strict" ? KuaishouDataOptionsMap[T]["data"] : any>;
|
|
14093
14054
|
}
|
|
14094
14055
|
|
|
14095
|
-
/**
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14056
|
+
/** amagi 的构造函数类型 */
|
|
14057
|
+
type AmagiConstructor = {
|
|
14058
|
+
new (options: cookiesOptions): amagiClient;
|
|
14059
|
+
(options: cookiesOptions): amagiClient;
|
|
14060
|
+
};
|
|
14061
|
+
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
14062
|
+
declare const amagi: AmagiConstructor & {
|
|
14063
|
+
/** 抖音相关功能模块 (工具集) */
|
|
14064
|
+
douyin: {
|
|
14065
|
+
sign: typeof douyinSign;
|
|
14066
|
+
douyinApiUrls: typeof douyinApiUrls;
|
|
14067
|
+
getDouyinData: typeof getDouyinData;
|
|
14068
|
+
api: typeof douyin;
|
|
14069
|
+
};
|
|
14070
|
+
/** B站相关功能模块 (工具集) */
|
|
14071
|
+
bilibili: {
|
|
14072
|
+
sign: {
|
|
14073
|
+
wbi_sign: typeof wbi_sign;
|
|
14074
|
+
av2bv: typeof av2bv;
|
|
14075
|
+
bv2av: typeof bv2av;
|
|
14076
|
+
};
|
|
14077
|
+
bilibiliApiUrls: typeof bilibiliApiUrls;
|
|
14078
|
+
getBilibiliData: typeof getBilibiliData;
|
|
14079
|
+
api: typeof bilibili;
|
|
14080
|
+
};
|
|
14081
|
+
/** 快手相关功能模块 (工具集) */
|
|
14082
|
+
kuaishou: {
|
|
14083
|
+
kuaishouApiUrls: typeof kuaishouApiUrls;
|
|
14084
|
+
getKuaishouData: typeof getKuaishouData;
|
|
14085
|
+
api: typeof kuaishou;
|
|
14086
|
+
};
|
|
14087
|
+
};
|
|
14088
|
+
/** After instantiation, it can interact with the specified platform API to quickly obtain data. */
|
|
14089
|
+
declare const Client: AmagiConstructor & {
|
|
14090
|
+
/** 抖音相关功能模块 (工具集) */
|
|
14091
|
+
douyin: {
|
|
14092
|
+
sign: typeof douyinSign;
|
|
14093
|
+
douyinApiUrls: typeof douyinApiUrls;
|
|
14094
|
+
getDouyinData: typeof getDouyinData;
|
|
14095
|
+
api: typeof douyin;
|
|
14096
|
+
};
|
|
14097
|
+
/** B站相关功能模块 (工具集) */
|
|
14098
|
+
bilibili: {
|
|
14099
|
+
sign: {
|
|
14100
|
+
wbi_sign: typeof wbi_sign;
|
|
14101
|
+
av2bv: typeof av2bv;
|
|
14102
|
+
bv2av: typeof bv2av;
|
|
14103
|
+
};
|
|
14104
|
+
bilibiliApiUrls: typeof bilibiliApiUrls;
|
|
14105
|
+
getBilibiliData: typeof getBilibiliData;
|
|
14106
|
+
api: typeof bilibili;
|
|
14107
|
+
};
|
|
14108
|
+
/** 快手相关功能模块 (工具集) */
|
|
14109
|
+
kuaishou: {
|
|
14110
|
+
kuaishouApiUrls: typeof kuaishouApiUrls;
|
|
14111
|
+
getKuaishouData: typeof getKuaishouData;
|
|
14112
|
+
api: typeof kuaishou;
|
|
14113
|
+
};
|
|
14114
|
+
};
|
|
14108
14115
|
|
|
14109
|
-
export {
|
|
14116
|
+
export { type BiliAv2Bv, type BiliBangumiVideoInfo, type BiliBangumiVideoPlayurlIsLogin, type BiliBangumiVideoPlayurlNoLogin, type BiliBiliVideoPlayurlNoLogin, type BiliBv2AV, type BiliCheckQrcode, type BiliDynamicCard, type BiliDynamicInfo, type BiliEmojiList, type BiliLiveRoomDef, type BiliLiveRoomDetail, type BiliNewLoginQrcode, type BiliOneWork, type BiliUserDynamic, type BiliUserFullView, type BiliUserProfile, type BiliVideoPlayurlIsLogin, type BiliWorkComments, type BilibiliDataOptions, type BilibiliDataOptionsMap, type BilibiliMethodOptionsMap, type BilibiliRequest, BilibiliValidateData, type DouyinDataOptions, type DouyinDataOptionsMap, type DouyinMethodOptionsMap, type DouyinRequest, DouyinValidateData, type DyEmojiList, type DyEmojiProList, type DyImageAlbumWork, type DyMusicWork, type DySearchInfo, type DySlidesWork, type DySuggestWords, type DyUserInfo, type DyUserLiveVideos, type DyUserPostVideos, type DyVideoWork, type DyWorkComments, type KsEmojiList, type KsOneWork, type KsWorkComments, KuaishouAPI, type KuaishouDataOptions, type KuaishouDataOptionsMap, type KuaishouMethodOptionsMap, type KusiahouRequest, KusiahouValidateData, Networks, type NetworksConfigType, type OmitMethodType, type TypeControl, amagi, amagiClient, av2bv, bilibili, bilibiliAPI, bilibiliApiUrls, bilibiliUtils, bv2av, type cookiesOptions, Client as default, douyin, douyinAPI, douyinApiUrls, douyinSign, douyinUtils, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, kuaishou, kuaishouAPI, kuaishouApiUrls, kuaishouUtils, logMiddleware, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, wbi_sign };
|