@ikenxuan/amagi 6.0.0-beta.3 → 6.1.2

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,44 +1,121 @@
1
- # @ikenxuan/amagi
1
+ <p align="center">
2
+ <h1 align="center">@ikenxuan/amagi</h1>
3
+ </p>
2
4
 
3
- [![npm version](https://img.shields.io/npm/v/@ikenxuan/amagi?style=flat-square&color=black)](https://www.npmjs.com/package/@ikenxuan/amagi)
4
- [![npm downloads](https://img.shields.io/npm/dm/@ikenxuan/amagi?style=flat-square&color=black)](https://www.npmjs.com/package/@ikenxuan/amagi)
5
+ <p align="center">
6
+ 抖音、B站、快手和小红书 Web 端数据接口的强大 Node.js 封装
7
+ </p>
5
8
 
6
- 抖音、B站、快手、小红书 Web 端数据接口的 Node.js 封装。
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@ikenxuan/amagi"><img src="https://img.shields.io/npm/v/@ikenxuan/amagi?style=flat-square&color=black" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/@ikenxuan/amagi"><img src="https://img.shields.io/npm/dm/@ikenxuan/amagi?style=flat-square&color=black" alt="npm downloads" /></a>
12
+ <a href="https://github.com/ikenxuan/amagi/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ikenxuan/amagi?style=flat-square&color=black" alt="license" /></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://amagi-docs.vercel.app">文档</a> ·
17
+ <a href="https://amagi.apifox.cn">API 参考</a> ·
18
+ <a href="https://github.com/ikenxuan/amagi/issues">反馈问题</a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ `@ikenxuan/amagi` 是一个独立发布的多平台 Node.js 数据获取 SDK,同时也内置了 HTTP 服务器功能。它为应用提供稳定、类型安全且经过严格参数校验的统一数据接口。
24
+
25
+ ## 特性
26
+
27
+ - **多平台支持**:深度封装抖音、B站、快手、小红书等平台的主流核心数据接口。
28
+ - **双模式调用**:既可以作为 Node.js SDK 在代码中直接调用,也可以一键启动本地 HTTP 服务供跨语言/跨进程使用。
29
+ - **类型安全**:采用 TypeScript 编写,提供完善的参数与响应类型定义。
30
+ - **参数校验**:底层基于 Zod 进行严格的入参和返回值校验,确保数据格式统一可靠。
31
+ - **事件驱动**:内置全新的事件系统,方便上层业务进行灵活的日志记录、拦截与运行监控。
32
+ - **双模块输出**:完美兼容 CommonJS (CJS) 与 ECMAScript Modules (ESM) 生态。
7
33
 
8
34
  ## 安装
9
35
 
36
+ 推荐使用 `pnpm` 进行安装:
37
+
38
+ ```bash
39
+ pnpm add @ikenxuan/amagi
40
+ ```
41
+
42
+ <details>
43
+ <summary>使用其他包管理器</summary>
44
+
10
45
  ```bash
11
- pnpm add @ikenxuan/amagi@beta
46
+ # npm
47
+ npm install @ikenxuan/amagi
48
+
49
+ # yarn
50
+ yarn add @ikenxuan/amagi
12
51
  ```
13
52
 
14
- ## 使用
53
+ </details>
54
+
55
+ ## 快速开始
56
+
57
+ ### 作为 SDK 调用
58
+
59
+ 直接在 Node.js 环境中引入并初始化 Amagi:
15
60
 
16
- ```ts
61
+ ```typescript
17
62
  import amagi from '@ikenxuan/amagi'
18
63
 
64
+ // 1. 初始化客户端并配置相关平台的 Cookies
19
65
  const client = amagi({
20
66
  cookies: {
21
67
  bilibili: 'SESSDATA=xxx; ...',
22
68
  douyin: 'ttwid=...; ...',
23
- kuaishou: 'did=...; ...',
24
- xiaohongshu: 'a1=...; ...',
69
+ // xiaohongshu: '...',
70
+ // kuaishou: '...'
25
71
  }
26
72
  })
27
73
 
28
- // 获取 B站视频信息
29
- const video = await client.bilibili.fetcher.fetchVideoInfo({
30
- bvid: 'BV1xx411c7mD'
74
+ // 2. 调用平台专属接口获取数据
75
+ async function fetchVideo() {
76
+ const video = await client.bilibili.fetcher.fetchVideoInfo({
77
+ bvid: 'BV1xx411c7mD'
78
+ })
79
+ console.log(video)
80
+ }
81
+
82
+ fetchVideo()
83
+ ```
84
+
85
+ ### 启动 HTTP 服务
86
+
87
+ 如果希望通过 HTTP API 的形式提供服务(例如给其他非 Node.js 应用调用):
88
+
89
+ ```typescript
90
+ import amagi from '@ikenxuan/amagi'
91
+
92
+ const client = amagi({
93
+ // 配置项...
31
94
  })
32
95
 
33
- // 启动 HTTP 服务
34
- client.startServer(4567)
96
+ // 一键启动 HTTP 服务器
97
+ client.startServer(4567)
98
+ // 服务将运行在 http://localhost:4567
35
99
  ```
36
100
 
37
- ## 文档
101
+ ## 文档资源
102
+
103
+ 更详细的接口说明和高级用法,请参阅在线文档:
38
104
 
39
105
  - [完整文档](https://amagi-docs.vercel.app)
40
- - [API 文档](https://amagi.apifox.cn)
106
+ - [快速上手](https://amagi-docs.vercel.app/docs/usage/getting-started)
107
+ - [Apifox 接口参考](https://amagi.apifox.cn)
108
+
109
+ ## 参与贡献
110
+
111
+ 本项目虽然是独立发布的 SDK,但目前的开发进度与维护重心主要受 `karin-plugin-kkk` 插件的业务需求驱动。当该插件出现新业务需要而本接口库尚未封装时,我才会对接口库进行针对性的更新和逻辑封装。目前插件侧的核心业务逻辑已基本完成,因此接口库的主动迭代会相对放缓。
112
+
113
+ 如果你(作为下游开发者)需要封装其他未支持的接口或业务逻辑,你可以选择:
114
+ 1. **自己 Fork 本项目**进行修改和定制。
115
+ 2. 阅读 [开发与贡献文档](https://amagi-docs.vercel.app/docs/dev) 后,向本项目提交 Pull Request 共同完善接口生态。
116
+
117
+ 非常欢迎提交 Issue 或 Pull Request!
41
118
 
42
119
  ## 许可证
43
120
 
44
- [GPL-3.0](../../LICENSE)
121
+ 本项目基于 [GPL-3.0](LICENSE) 协议开源。