@ikenxuan/amagi 4.4.9 → 4.4.10

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 CHANGED
@@ -1,139 +1,190 @@
1
- # amagi(泥干嘛哈哈... 🎉
1
+ # amagi /ˈæmədʒi/ 🎵
2
2
 
3
- - 抖音、B 站的 web 端相关数据接口基于 Node.js 的实现,支持最低 node 版本为 v18
3
+ 抖音、bilibili web 端相关数据接口基于 Node.js 的实现。支持最低 node 版本为 v18 🚀
4
4
 
5
- ![amagi](https://socialify.git.ci/ikenxuan/amagi/image?font=Source%20Code%20Pro&forks=1&issues=1&language=1&name=1&owner=1&pattern=Floating%20Cogs&pulls=1&stargazers=1&theme=Auto)
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
- ```js
18
- import Client, { amagi, getDouyinData, getBilibiliData } from '@ikenxuan/amagi'
32
+ // 创建客户端实例
33
+ const amagi = new Client({
34
+ douyin: '', // 抖音 cookie(可选)
35
+ bilibili: '', // B站 cookie(可选)
36
+ })
19
37
 
20
- const douyinck = '你的抖音ck'
21
- const bilibilick = '你的B站ck'
38
+ // 使用示例
39
+ async function example() {
40
+ // 获取抖音搜索数据
41
+ const searchData = await amagi.getDouyinData('搜索数据', {
42
+ query: '热门视频',
43
+ number: 10,
44
+ })
22
45
 
23
- // 方法1(函数重载使得参数二和参数三可互换)
24
- getDouyinData('视频作品数据', douyinck, { aweme_id: '7403311630219578660' })
25
- .then((data) => console.log('抖音:' + data))
26
- .catch((err) => console.error(err))
46
+ // 获取B站视频数据
47
+ const videoData = await amagi.getBilibiliData('单个视频作品数据', {
48
+ bvid: 'BV1fK4y1q79u',
49
+ })
27
50
 
28
- getBilibiliData('单个视频作品数据', bilibilick, { bvid: 'BV1Nx4y147n3' })
29
- .then((data) => console.log('B站' + data))
30
- .catch((err) => console.error(err))
51
+ console.log(searchData)
52
+ }
31
53
 
32
- // 方法2
33
- // 初始化
34
- const instance = new Client({
35
- douyin: douyinck,
36
- // ......
37
- })
38
- // 或者可以这样
39
- const instance = amagi({
40
- douyin: douyinck,
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
- instance
44
- .getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
45
- .then((data) => console.log(data))
46
- .catch((err) => console.error(err))
66
+
67
+ // 启动本地服务,默认端口 4567
68
+ const app = amagi.startClient()
69
+ // 或指定端口
70
+ // const app = amagi.startClient(8080)
47
71
  ```
48
72
 
49
- - 参数一详见 [**抖音数据类型**](./src/types/DouyinAPIParams.ts) [**B 站数据类型**](./src/types/BilibiliAPIParams.ts)
73
+ 启动后可通过以下路径访问 API:
50
74
 
51
- - 传递对象的参数 **同上** 或参照 [**API 文档**](https://amagi.apifox.cn)
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
- - API 文档: [**Apifox**](https://amagi.apifox.cn)
82
+ PS: 以下功能模块的使用方法与上述基本用法类似,我也不知道为什么要写这个。。。
58
83
 
59
- ```js
60
- import amagi from '@ikenxuan/amagi'
84
+ ### 抖音功能模块 📱
61
85
 
62
- const Client = new amagi({
63
- douyin: '你的抖音ck',
64
- bilibili: '你的B站ck',
65
- })
86
+ 抖音相关功能模块提供了一系列工具和 API 接口,用于获取抖音平台的数据。
66
87
 
67
- Client.startClient(4567) // 监听端口
68
- ```
88
+ ```javascript
89
+ import { douyinUtils } from '@ikenxuan/amagi'
69
90
 
70
- **如果你是使用的 `commonjs` 模块,请使用 `require()` 导入**
91
+ // 使用签名算法
92
+ const mstoken = douyinUtils.sign.Mstoken(107)
93
+ const verifyFp = douyinUtils.sign.VerifyFpManager()
94
+ const abSign = douyinUtils.sign.AB('需要签名的地址')
71
95
 
72
- ```js
73
- const Client = require('@ikenxuan/amagi').default
74
- const { amagi } = require('@ikenxuan/amagi')
75
- const { getBilibiliData } = require('@ikenxuan/amagi')
96
+ // 使用 API 接口
97
+ const videoData = await douyinUtils.api.getWorkInfo(
98
+ {
99
+ aweme_id: '视频ID',
100
+ },
101
+ '有效的用户 Cookie'
102
+ )
76
103
 
77
- const douyinck = '你的抖音ck'
78
- const bilibilick = '你的B站ck'
104
+ const userInfo = await douyinUtils.api.getUserProfile(
105
+ {
106
+ sec_uid: '用户ID',
107
+ },
108
+ '有效的用户 Cookie'
109
+ )
79
110
 
80
- // 初始化
81
- const instance = new Client({
82
- douyin: douyinck,
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
- // 启动http服务
92
- instance.startClient(6666)
118
+ 主要功能:
93
119
 
94
- // 获取抖音评论数据
95
- instance
96
- .getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
97
- .then((data) => console.log('抖音:' + data))
98
- .catch((err) => console.error(err))
120
+ - 📹 视频/图集作品数据获取
121
+ - 👤 用户信息获取
122
+ - 💬 评论数据获取
123
+ - 🔍 搜索功能
124
+ - 🎬 直播间信息
125
+ - 🎵 音乐数据
126
+ - 😄 表情数据
99
127
 
100
- // 获取B站视频信息
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
- > [!IMPORTANT] > **开发环境下,支持最低 node 版本为 v18**
132
+ ```javascript
133
+ import { bilibiliUtils } from '@ikenxuan/amagi'
109
134
 
110
- - [**fork**](https://github.com/ikenxuan/amagi/fork) 项目到自己的仓库并克隆到本地
111
- - 安装依赖
135
+ // 获取视频信息
136
+ const videoInfo = await bilibiliUtils.api.getVideoInfo({
137
+ bvid: 'BV1fK4y1q79u',
138
+ })
112
139
 
113
- ```
114
- pnpm install
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
- pnpm build
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
- ## License 📜
170
+ ## 免责声明 ⚠️
124
171
 
125
- [GPL-3.0](https://github.com/ikenxuan/amagi/blob/main/LICENSE)
172
+ - ⭐ 这个项目免费开源,不存在收费。
173
+ - 🛡️ 本项目的作者不承担任何责任,包括但不限于因使用本项目而导致的任何损失或损害。
174
+ - 📚 本项目仅供学习和研究使用,不得用于任何商业目的。
175
+ - 🔒 本项目的作者不对因使用本项目而产生的任何后果负责。
176
+ - 📝 本项目的使用者在下载、安装、运行或使用本工具时,即表示已阅读并同意本免责声明。如有异议,请立即停止使用本工具,并删除所有相关文件。
177
+ - 🔄 本项目的作者保留随时修改、更新、删除或终止本工具的权利,无需事先通知或承担任何义务。
126
178
 
127
- ## 声明 ⚠️
179
+ 🔐 本仓库没有后门,本仓库不会上传有关你的任何信息到第三方。
128
180
 
129
- 本库没有后门,本库不会上传有关你的任何信息到第三方。
130
- 所配置的 ck 只会用于请求官方 API 接口
181
+ 🍪 所传递的用户 cookies 只会用于请求官方 API 接口
131
182
 
132
- <h2>未经同意,禁止将本项目的开源代码用于任何商业目的。因使用本项目产生的一切问题与后果由使用者自行承担,项目开发者不承担任何责任</h2>
183
+ ## 鸣谢 🙏
133
184
 
134
- ## amagi 的诞生参考了以下开源项目 🙏:
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
- /** a_bogus 签名算法 */
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(data2) {
2374
- this.douyin = (data2 == null ? void 0 : data2.douyin) ?? "";
2375
- this.bilibili = (data2 == null ? void 0 : data2.bilibili) ?? "";
2376
- this.kuaishou = (data2 == null ? void 0 : data2.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,21 +2448,21 @@ var amagiClient = class {
2474
2448
  };
2475
2449
 
2476
2450
  // src/index.ts
2477
- var index_default = amagiClient;
2478
- function amagi(options) {
2479
- return new amagiClient(options);
2480
- }
2481
- function Amagi(options) {
2482
- return new amagiClient(options);
2483
- }
2451
+ var createAmagiClient = (data2) => {
2452
+ return new amagiClient(data2);
2453
+ };
2454
+ Object.defineProperty(createAmagiClient, "prototype", {
2455
+ value: amagiClient.prototype
2456
+ });
2457
+ var Client = createAmagiClient;
2458
+ var index_default = Client;
2484
2459
 
2485
- exports.Amagi = Amagi;
2486
2460
  exports.BilibiliValidateData = BilibiliValidateData;
2461
+ exports.Client = Client;
2487
2462
  exports.DouyinValidateData = DouyinValidateData;
2488
2463
  exports.KuaishouAPI = KuaishouAPI;
2489
2464
  exports.KusiahouValidateData = KusiahouValidateData;
2490
2465
  exports.Networks = Networks;
2491
- exports.amagi = amagi;
2492
2466
  exports.amagiClient = amagiClient;
2493
2467
  exports.av2bv = av2bv;
2494
2468
  exports.bilibili = bilibili;
@@ -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
- /** a_bogus 签名算法 */
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(data2) {
2362
- this.douyin = (data2 == null ? void 0 : data2.douyin) ?? "";
2363
- this.bilibili = (data2 == null ? void 0 : data2.bilibili) ?? "";
2364
- this.kuaishou = (data2 == null ? void 0 : data2.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,13 @@ var amagiClient = class {
2462
2436
  };
2463
2437
 
2464
2438
  // src/index.ts
2465
- var index_default = amagiClient;
2466
- function amagi(options) {
2467
- return new amagiClient(options);
2468
- }
2469
- function Amagi(options) {
2470
- return new amagiClient(options);
2471
- }
2439
+ var createAmagiClient = (data2) => {
2440
+ return new amagiClient(data2);
2441
+ };
2442
+ Object.defineProperty(createAmagiClient, "prototype", {
2443
+ value: amagiClient.prototype
2444
+ });
2445
+ var Client = createAmagiClient;
2446
+ var index_default = Client;
2472
2447
 
2473
- export { Amagi, BilibiliValidateData, DouyinValidateData, KuaishouAPI, KusiahouValidateData, Networks, amagi, amagiClient, av2bv, bilibili, bilibiliAPI, bilibiliApiUrls, bilibiliUtils, bv2av, index_default 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 };
2448
+ export { BilibiliValidateData, Client, DouyinValidateData, KuaishouAPI, KusiahouValidateData, Networks, amagiClient, av2bv, bilibili, bilibiliAPI, bilibiliApiUrls, bilibiliUtils, bv2av, index_default 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 };
@@ -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
- /** a_bogus 签名算法 */
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 ckParams = {
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(data: ckParams);
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,17 @@ 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
- * 初始化 amagi
14097
- * @param options 配置参数
14098
- * @returns amagi 实例
14099
- */
14100
- declare function amagi(options: ckParams): amagiClient;
14101
- /**
14102
- * 初始化 amagi
14103
- * @deprecated 即将废弃,请使用 amagi 代替
14104
- * @param options 配置参数
14105
- * @returns amagi 实例
14106
- */
14107
- declare function Amagi(options: ckParams): amagiClient;
14056
+ /** amagi 的构造函数类型 */
14057
+ type AmagiConstructor = {
14058
+ new (options: cookiesOptions): amagiClient;
14059
+ (options: cookiesOptions): amagiClient;
14060
+ };
14061
+ declare const Client: AmagiConstructor;
14108
14062
 
14109
- export { Amagi, 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 ckParams, amagiClient 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 };
14063
+ export { type AmagiConstructor, 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, Client, 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikenxuan/amagi",
3
- "version": "4.4.9",
3
+ "version": "4.4.10",
4
4
  "description": "抖音、B站的 web 端相关数据接口基于 Node.js 的实现",
5
5
  "keywords": [
6
6
  "douyin",