@ikenxuan/amagi 4.4.7 → 4.4.9
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 +57 -34
- package/dist/default/cjs/index.cjs +1150 -685
- package/dist/default/esm/index.mjs +1140 -683
- package/dist/default/index.d.ts +533 -402
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,116 +1,139 @@
|
|
|
1
1
|
# amagi(泥干嘛哈哈... 🎉
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
- 抖音、B 站的 web 端相关数据接口基于 Node.js 的实现,支持最低 node 版本为 v18
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
## 使用 📦
|
|
8
|
+
|
|
9
9
|
```
|
|
10
|
-
pnpm add @ikenxuan/amagi
|
|
10
|
+
pnpm add @ikenxuan/amagi@latest
|
|
11
11
|
```
|
|
12
|
+
|
|
12
13
|
## 快速上手 🚀
|
|
13
14
|
|
|
14
15
|
**_直接获取相关数据_**
|
|
16
|
+
|
|
15
17
|
```js
|
|
16
|
-
import Client, { getDouyinData, getBilibiliData
|
|
18
|
+
import Client, { amagi, getDouyinData, getBilibiliData } from '@ikenxuan/amagi'
|
|
17
19
|
|
|
18
20
|
const douyinck = '你的抖音ck'
|
|
19
21
|
const bilibilick = '你的B站ck'
|
|
20
22
|
|
|
21
|
-
// 方法1
|
|
22
|
-
getDouyinData('
|
|
23
|
-
.then(data => console.log('抖音:' + data))
|
|
24
|
-
.catch(err => console.error(err))
|
|
23
|
+
// 方法1(函数重载使得参数二和参数三可互换)
|
|
24
|
+
getDouyinData('视频作品数据', douyinck, { aweme_id: '7403311630219578660' })
|
|
25
|
+
.then((data) => console.log('抖音:' + data))
|
|
26
|
+
.catch((err) => console.error(err))
|
|
25
27
|
|
|
26
28
|
getBilibiliData('单个视频作品数据', bilibilick, { bvid: 'BV1Nx4y147n3' })
|
|
27
|
-
.then(data => console.log('B站' + data))
|
|
28
|
-
.catch(err => console.error(err))
|
|
29
|
+
.then((data) => console.log('B站' + data))
|
|
30
|
+
.catch((err) => console.error(err))
|
|
29
31
|
|
|
30
32
|
// 方法2
|
|
31
|
-
|
|
33
|
+
// 初始化
|
|
34
|
+
const instance = new Client({
|
|
32
35
|
douyin: douyinck,
|
|
33
|
-
|
|
36
|
+
// ......
|
|
34
37
|
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
// 或者可以这样
|
|
39
|
+
const instance = amagi({
|
|
40
|
+
douyin: douyinck,
|
|
41
|
+
// ......
|
|
42
|
+
})
|
|
43
|
+
instance
|
|
44
|
+
.getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
|
|
45
|
+
.then((data) => console.log(data))
|
|
46
|
+
.catch((err) => console.error(err))
|
|
38
47
|
```
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
- 参数一详见 [**抖音数据类型**](./src/types/DouyinAPIParams.ts) [**B 站数据类型**](./src/types/BilibiliAPIParams.ts)
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
- 传递对象的参数 **同上** 或参照 [**API 文档**](https://amagi.apifox.cn)
|
|
43
52
|
|
|
44
53
|
---
|
|
45
54
|
|
|
46
55
|
**_本地部署一个服务端_**
|
|
47
|
-
|
|
56
|
+
|
|
57
|
+
- API 文档: [**Apifox**](https://amagi.apifox.cn)
|
|
48
58
|
|
|
49
59
|
```js
|
|
50
60
|
import amagi from '@ikenxuan/amagi'
|
|
51
61
|
|
|
52
62
|
const Client = new amagi({
|
|
53
63
|
douyin: '你的抖音ck',
|
|
54
|
-
bilibili: '你的B站ck'
|
|
64
|
+
bilibili: '你的B站ck',
|
|
55
65
|
})
|
|
56
66
|
|
|
57
67
|
Client.startClient(4567) // 监听端口
|
|
58
68
|
```
|
|
59
69
|
|
|
60
70
|
**如果你是使用的 `commonjs` 模块,请使用 `require()` 导入**
|
|
71
|
+
|
|
61
72
|
```js
|
|
62
73
|
const Client = require('@ikenxuan/amagi').default
|
|
74
|
+
const { amagi } = require('@ikenxuan/amagi')
|
|
63
75
|
const { getBilibiliData } = require('@ikenxuan/amagi')
|
|
64
76
|
|
|
65
77
|
const douyinck = '你的抖音ck'
|
|
66
78
|
const bilibilick = '你的B站ck'
|
|
67
79
|
|
|
68
80
|
// 初始化
|
|
69
|
-
const
|
|
81
|
+
const instance = new Client({
|
|
70
82
|
douyin: douyinck,
|
|
71
|
-
|
|
83
|
+
// ......
|
|
84
|
+
})
|
|
85
|
+
// 或者可以这样
|
|
86
|
+
const instance = amagi({
|
|
87
|
+
douyin: douyinck,
|
|
88
|
+
// ......
|
|
72
89
|
})
|
|
73
90
|
|
|
74
91
|
// 启动http服务
|
|
75
|
-
|
|
92
|
+
instance.startClient(6666)
|
|
76
93
|
|
|
77
94
|
// 获取抖音评论数据
|
|
78
|
-
|
|
79
|
-
.
|
|
80
|
-
.
|
|
95
|
+
instance
|
|
96
|
+
.getDouyinData('评论数据', { aweme_id: '7403311630219578660', number: 25 })
|
|
97
|
+
.then((data) => console.log('抖音:' + data))
|
|
98
|
+
.catch((err) => console.error(err))
|
|
81
99
|
|
|
82
100
|
// 获取B站视频信息
|
|
83
101
|
getBilibiliData('单个视频作品数据', bilibilick, { bvid: 'BV1Nx4y147n3' })
|
|
84
|
-
.then(data => console.log('B站' + data))
|
|
85
|
-
.catch(err => console.error(err))
|
|
102
|
+
.then((data) => console.log('B站' + data))
|
|
103
|
+
.catch((err) => console.error(err))
|
|
86
104
|
```
|
|
87
105
|
|
|
88
106
|
## 开发构建 🛠️
|
|
89
107
|
|
|
90
|
-
> [!IMPORTANT]
|
|
91
|
-
|
|
108
|
+
> [!IMPORTANT] > **开发环境下,支持最低 node 版本为 v18**
|
|
109
|
+
|
|
110
|
+
- [**fork**](https://github.com/ikenxuan/amagi/fork) 项目到自己的仓库并克隆到本地
|
|
111
|
+
- 安装依赖
|
|
92
112
|
|
|
93
|
-
* [**fork**](https://github.com/ikenxuan/amagi/fork) 项目到自己的仓库并克隆到本地
|
|
94
|
-
* 安装依赖
|
|
95
113
|
```
|
|
96
114
|
pnpm install
|
|
97
115
|
```
|
|
98
|
-
|
|
116
|
+
|
|
117
|
+
- 编译
|
|
118
|
+
|
|
99
119
|
```
|
|
100
120
|
pnpm build
|
|
101
121
|
```
|
|
102
122
|
|
|
103
123
|
## License 📜
|
|
124
|
+
|
|
104
125
|
[GPL-3.0](https://github.com/ikenxuan/amagi/blob/main/LICENSE)
|
|
105
126
|
|
|
106
127
|
## 声明 ⚠️
|
|
128
|
+
|
|
107
129
|
本库没有后门,本库不会上传有关你的任何信息到第三方。
|
|
108
|
-
所配置的ck只会用于请求官方API接口
|
|
130
|
+
所配置的 ck 只会用于请求官方 API 接口
|
|
109
131
|
|
|
110
132
|
<h2>未经同意,禁止将本项目的开源代码用于任何商业目的。因使用本项目产生的一切问题与后果由使用者自行承担,项目开发者不承担任何责任</h2>
|
|
111
133
|
|
|
112
134
|
## amagi 的诞生参考了以下开源项目 🙏:
|
|
135
|
+
|
|
113
136
|
- [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
|
|
114
137
|
- [NearHuiwen/TiktokDouyinCrawler](https://github.com/NearHuiwen/TiktokDouyinCrawler)
|
|
115
138
|
- [Evil0ctal/Douyin_TikTok_Download_API](https://github.com/Evil0ctal/Douyin_TikTok_Download_API)
|
|
116
|
-
- [Johnserf-Seed/f2](https://github.com/Johnserf-Seed/f2)
|
|
139
|
+
- [Johnserf-Seed/f2](https://github.com/Johnserf-Seed/f2)
|