@ikenxuan/amagi 4.4.8 → 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 +155 -81
- package/dist/default/cjs/index.cjs +1107 -672
- package/dist/default/esm/index.mjs +1096 -668
- package/dist/default/index.d.ts +532 -452
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,116 +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
|
+
"amagi" /ˈæmədʒi/ 名称灵感来源于网络流行的"你干嘛~哎呦~"视频,这是由歌手 cxk 的一段采访视频衍生而来的网络文化现象。这个梗在抖音和 bilibili [BV1St41137jm](https://www.bilibili.com/video/BV1St41137jm) 上广泛传播,成为了中国互联网文化的一部分。选择这个名称也象征着本项目与这些平台内容的紧密联系。🎤💃
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
pnpm add @ikenxuan/amagi
|
|
11
|
-
```
|
|
12
|
-
## 快速上手 🚀
|
|
9
|
+
此生必看 [BV1DL411X7jE](https://www.bilibili.com/video/BV1DL411X7jE)
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import Client, { getDouyinData, getBilibiliData } from '@ikenxuan/amagi'
|
|
11
|
+
## 项目简介 📝
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
const bilibilick = '你的B站ck'
|
|
13
|
+
本项目最初的代码从 [kkkkkk-10086](https://github.com/ikenxuan/kkkkkk-10086) 抽离。主要负责相关数据接口的封装。
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
getDouyinData('单个视频作品数据', douyinck, { aweme_id: '7403311630219578660' })
|
|
23
|
-
.then(data => console.log('抖音:' + data))
|
|
24
|
-
.catch(err => console.error(err))
|
|
15
|
+
amagi 将作为一个独立的上游模块,提供给下游 [karin-plugin-kkk](https://github.com/ikenxuan/karin-plugin-kkk) 和 [kkkkkk-10086](https://github.com/ikenxuan/kkkkkk-10086) 进行视频解析相关业务使用。这两个项目的主要业务基本已经完成,所以如果它们没有什么特殊新业务需求,amagi 大概也不会有新的 API 更新。
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
.then(data => console.log('B站' + data))
|
|
28
|
-
.catch(err => console.error(err))
|
|
17
|
+
当然,如果你的下游有新的业务需求,欢迎提 issue 或 pr。(其实作者本人很菜,issue 不一定能解决)
|
|
29
18
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
amagi.getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
|
|
36
|
-
.then(data => console.log(data))
|
|
37
|
-
.catch(err => console.error(err))
|
|
19
|
+
## 安装 📦
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @ikenxuan/amagi@latest
|
|
38
23
|
```
|
|
39
24
|
|
|
40
|
-
|
|
25
|
+
## 默认导出使用方法 🚀
|
|
41
26
|
|
|
42
|
-
|
|
27
|
+
### 基本用法 ✨
|
|
43
28
|
|
|
44
|
-
|
|
29
|
+
```javascript
|
|
30
|
+
import Client from '@ikenxuan/amagi'
|
|
45
31
|
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
// 创建客户端实例
|
|
33
|
+
const amagi = new Client({
|
|
34
|
+
douyin: '', // 抖音 cookie(可选)
|
|
35
|
+
bilibili: '', // B站 cookie(可选)
|
|
36
|
+
})
|
|
48
37
|
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
// 使用示例
|
|
39
|
+
async function example() {
|
|
40
|
+
// 获取抖音搜索数据
|
|
41
|
+
const searchData = await amagi.getDouyinData('搜索数据', {
|
|
42
|
+
query: '热门视频',
|
|
43
|
+
number: 10,
|
|
44
|
+
})
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
46
|
+
// 获取B站视频数据
|
|
47
|
+
const videoData = await amagi.getBilibiliData('单个视频作品数据', {
|
|
48
|
+
bvid: 'BV1fK4y1q79u',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
console.log(searchData)
|
|
52
|
+
}
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
example()
|
|
58
55
|
```
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
const Client = require('@ikenxuan/amagi').default
|
|
63
|
-
const { getBilibiliData } = require('@ikenxuan/amagi')
|
|
57
|
+
### 启动本地 HTTP 服务 🌐
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
```javascript
|
|
60
|
+
import Client from '@ikenxuan/amagi'
|
|
67
61
|
|
|
68
|
-
// 初始化
|
|
69
62
|
const amagi = new Client({
|
|
70
|
-
douyin:
|
|
71
|
-
bilibili:
|
|
63
|
+
douyin: '你的抖音cookie',
|
|
64
|
+
bilibili: '你的B站cookie',
|
|
72
65
|
})
|
|
73
66
|
|
|
74
|
-
//
|
|
75
|
-
amagi.startClient(
|
|
67
|
+
// 启动本地服务,默认端口 4567
|
|
68
|
+
const app = amagi.startClient()
|
|
69
|
+
// 或指定端口
|
|
70
|
+
// const app = amagi.startClient(8080)
|
|
71
|
+
```
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
amagi.getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
|
|
79
|
-
.then(data => console.log('抖音:' + data))
|
|
80
|
-
.catch(err => console.error(err))
|
|
73
|
+
启动后可通过以下路径访问 API:
|
|
81
74
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.then(data => console.log('B站' + data))
|
|
85
|
-
.catch(err => console.error(err))
|
|
86
|
-
```
|
|
75
|
+
- 抖音 API: `http://localhost:4567/api/douyin/...` 📱
|
|
76
|
+
- bilibili API: `http://localhost:4567/api/bilibili/...` 📺
|
|
87
77
|
|
|
88
|
-
|
|
78
|
+
API 文档: https://amagi.apifox.cn 📝
|
|
89
79
|
|
|
90
|
-
|
|
91
|
-
> **开发环境下,支持最低node版本为 v18**
|
|
80
|
+
## 平台功能模块 🧩
|
|
92
81
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
PS: 以下功能模块的使用方法与上述基本用法类似,我也不知道为什么要写这个。。。
|
|
83
|
+
|
|
84
|
+
### 抖音功能模块 📱
|
|
85
|
+
|
|
86
|
+
抖音相关功能模块提供了一系列工具和 API 接口,用于获取抖音平台的数据。
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
import { douyinUtils } from '@ikenxuan/amagi'
|
|
90
|
+
|
|
91
|
+
// 使用签名算法
|
|
92
|
+
const mstoken = douyinUtils.sign.Mstoken(107)
|
|
93
|
+
const verifyFp = douyinUtils.sign.VerifyFpManager()
|
|
94
|
+
const abSign = douyinUtils.sign.AB('需要签名的地址')
|
|
95
|
+
|
|
96
|
+
// 使用 API 接口
|
|
97
|
+
const videoData = await douyinUtils.api.getWorkInfo(
|
|
98
|
+
{
|
|
99
|
+
aweme_id: '视频ID',
|
|
100
|
+
},
|
|
101
|
+
'有效的用户 Cookie'
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const userInfo = await douyinUtils.api.getUserProfile(
|
|
105
|
+
{
|
|
106
|
+
sec_uid: '用户ID',
|
|
107
|
+
},
|
|
108
|
+
'有效的用户 Cookie'
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
// 直接获取数据
|
|
112
|
+
const searchResult = await douyinUtils.getDouyinData('搜索数据', {
|
|
113
|
+
query: '搜索关键词',
|
|
114
|
+
number: 10,
|
|
115
|
+
})
|
|
99
116
|
```
|
|
100
|
-
|
|
117
|
+
|
|
118
|
+
主要功能:
|
|
119
|
+
|
|
120
|
+
- 📹 视频/图集作品数据获取
|
|
121
|
+
- 👤 用户信息获取
|
|
122
|
+
- 💬 评论数据获取
|
|
123
|
+
- 🔍 搜索功能
|
|
124
|
+
- 🎬 直播间信息
|
|
125
|
+
- 🎵 音乐数据
|
|
126
|
+
- 😄 表情数据
|
|
127
|
+
|
|
128
|
+
### bilibili 功能模块 📺
|
|
129
|
+
|
|
130
|
+
bilibili 相关功能模块提供了获取 bilibili 平台数据的工具和 API。
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
import { bilibiliUtils } from '@ikenxuan/amagi'
|
|
134
|
+
|
|
135
|
+
// 获取视频信息
|
|
136
|
+
const videoInfo = await bilibiliUtils.api.getVideoInfo({
|
|
137
|
+
bvid: 'BV1fK4y1q79u',
|
|
138
|
+
})
|
|
139
|
+
|
|
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
|
+
})
|
|
101
150
|
```
|
|
102
151
|
|
|
103
|
-
|
|
104
|
-
|
|
152
|
+
主要功能:
|
|
153
|
+
|
|
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) ⚖️
|
|
169
|
+
|
|
170
|
+
## 免责声明 ⚠️
|
|
171
|
+
|
|
172
|
+
- ⭐ 这个项目免费开源,不存在收费。
|
|
173
|
+
- 🛡️ 本项目的作者不承担任何责任,包括但不限于因使用本项目而导致的任何损失或损害。
|
|
174
|
+
- 📚 本项目仅供学习和研究使用,不得用于任何商业目的。
|
|
175
|
+
- 🔒 本项目的作者不对因使用本项目而产生的任何后果负责。
|
|
176
|
+
- 📝 本项目的使用者在下载、安装、运行或使用本工具时,即表示已阅读并同意本免责声明。如有异议,请立即停止使用本工具,并删除所有相关文件。
|
|
177
|
+
- 🔄 本项目的作者保留随时修改、更新、删除或终止本工具的权利,无需事先通知或承担任何义务。
|
|
178
|
+
|
|
179
|
+
🔐 本仓库没有后门,本仓库不会上传有关你的任何信息到第三方。
|
|
180
|
+
|
|
181
|
+
🍪 所传递的用户 cookies 只会用于请求官方 API 接口
|
|
105
182
|
|
|
106
|
-
##
|
|
107
|
-
本库没有后门,本库不会上传有关你的任何信息到第三方。
|
|
108
|
-
所配置的ck只会用于请求官方API接口
|
|
183
|
+
## 鸣谢 🙏
|
|
109
184
|
|
|
110
|
-
|
|
185
|
+
amagi 的诞生参考了以下开源项目:
|
|
111
186
|
|
|
112
|
-
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
115
|
-
- [
|
|
116
|
-
- [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)
|