@ikenxuan/amagi 4.1.1 → 4.2.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/lib/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export * from './model/index.js';
2
2
  export * from './platform/index.js';
3
3
  export * from './server/index.js';
4
4
  export * from './types/index.js';
5
- import { amagi as AmagiClient, initClientParams } from './server/index.js';
5
+ import { amagi as AmagiClient, ckParams } from './server/index.js';
6
6
  export default AmagiClient;
7
- export declare function Amagi(options: initClientParams): AmagiClient;
7
+ export declare function Amagi(options: ckParams): AmagiClient;
@@ -2,6 +2,7 @@ import { BilibiliDataOptions, BilibiliDataOptionsMap, DouyinDataOptions, DouyinD
2
2
  /**
3
3
  * 获取抖音数据
4
4
  * @param type - 请求数据类型
5
+ * @param cookie - 有效的用户Cookie
5
6
  * @param options - 请求参数,是一个对象
6
7
  * @returns 返回接口的原始数据
7
8
  * @example
@@ -16,6 +17,7 @@ export declare const getDouyinData: <T extends keyof DouyinDataOptionsMap>(type:
16
17
  /**
17
18
  * 获取B站数据
18
19
  * @param type - 请求数据类型
20
+ * @param cookie - 有效的用户Cookie
19
21
  * @param options - 请求参数,是一个对象
20
22
  * @returns 返回接口的原始数据
21
23
  * @example
@@ -29,6 +31,7 @@ export declare function getBilibiliData<T extends keyof BilibiliDataOptionsMap>(
29
31
  /**
30
32
  * 获取快手数据
31
33
  * @param type - 请求数据类型
34
+ * @param cookie - 有效的用户Cookie
32
35
  * @param options - 请求参数,是一个对象
33
36
  * @returns 返回接口的原始数据
34
37
  * @example
@@ -2,6 +2,7 @@ import { BilibiliData, DouyinData, KuaishouData } from '../platform/index.js';
2
2
  /**
3
3
  * 获取抖音数据
4
4
  * @param type - 请求数据类型
5
+ * @param cookie - 有效的用户Cookie
5
6
  * @param options - 请求参数,是一个对象
6
7
  * @returns 返回接口的原始数据
7
8
  * @example
@@ -19,6 +20,7 @@ export const getDouyinData = async (type, cookie, options) => {
19
20
  /**
20
21
  * 获取B站数据
21
22
  * @param type - 请求数据类型
23
+ * @param cookie - 有效的用户Cookie
22
24
  * @param options - 请求参数,是一个对象
23
25
  * @returns 返回接口的原始数据
24
26
  * @example
@@ -35,6 +37,7 @@ export async function getBilibiliData(methodType, cookie, options) {
35
37
  /**
36
38
  * 获取快手数据
37
39
  * @param type - 请求数据类型
40
+ * @param cookie - 有效的用户Cookie
38
41
  * @param options - 请求参数,是一个对象
39
42
  * @returns 返回接口的原始数据
40
43
  * @example
@@ -1,6 +1,7 @@
1
1
  import { bilibiliAPI } from './API.js';
2
2
  import { BilibiliData } from './getdata.js';
3
3
  import { qtparam } from './qtparam.js';
4
+ import { registerBilibiliRoutes } from './routes.js';
4
5
  import { wbi_sign } from './sign/wbi.js';
5
6
  export { av2bv, bv2av } from './sign/bv2av.js';
6
- export { bilibiliAPI, BilibiliData, qtparam, wbi_sign };
7
+ export { bilibiliAPI, BilibiliData, qtparam, registerBilibiliRoutes, wbi_sign };
@@ -1,6 +1,7 @@
1
1
  import { bilibiliAPI } from './API.js';
2
2
  import { BilibiliData } from './getdata.js';
3
3
  import { qtparam } from './qtparam.js';
4
+ import { registerBilibiliRoutes } from './routes.js';
4
5
  import { wbi_sign } from './sign/wbi.js';
5
6
  export { av2bv, bv2av } from './sign/bv2av.js';
6
- export { bilibiliAPI, BilibiliData, qtparam, wbi_sign };
7
+ export { bilibiliAPI, BilibiliData, qtparam, registerBilibiliRoutes, wbi_sign };
@@ -0,0 +1,7 @@
1
+ import { FastifyInstance } from 'fastify';
2
+ /**
3
+ * 注册B站相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export declare const registerBilibiliRoutes: (fastify: FastifyInstance, cookie: string) => void;
@@ -0,0 +1,120 @@
1
+ import { BilibiliData } from '../../platform/bilibili/index.js';
2
+ /**
3
+ * 注册B站相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export const registerBilibiliRoutes = (fastify, cookie) => {
8
+ fastify.register(async (fastify) => {
9
+ await Promise.resolve();
10
+ fastify.get('/new_login_qrcode', async (request, reply) => {
11
+ reply.type('application/json').send(await BilibiliData({
12
+ methodType: '申请二维码'
13
+ }));
14
+ });
15
+ fastify.get('/check_qrcode', async (request, reply) => {
16
+ reply.type('application/json').send(await BilibiliData({
17
+ methodType: '二维码状态',
18
+ qrcode_key: request.query.qrcode_key
19
+ }));
20
+ });
21
+ fastify.get('/login_basic_info', async (request, reply) => {
22
+ reply.type('application/json').send(await BilibiliData({
23
+ methodType: '登录基本信息'
24
+ }, request.headers.cookie));
25
+ });
26
+ fastify.get('/fetch_one_video', async (request, reply) => {
27
+ reply.type('application/json').send(await BilibiliData({
28
+ methodType: '单个视频作品数据',
29
+ bvid: request.query.bvid
30
+ }, request.headers.cookie ?? cookie));
31
+ });
32
+ fastify.get('/fetch_video_playurl', async (request, reply) => {
33
+ reply.type('application/json').send(await BilibiliData({
34
+ methodType: '单个视频下载信息数据',
35
+ avid: request.query.avid,
36
+ cid: request.query.cid
37
+ }, request.headers.cookie ?? cookie));
38
+ });
39
+ fastify.get('/fetch_work_comments', async (request, reply) => {
40
+ reply.type('application/json').send(await BilibiliData({
41
+ methodType: '评论数据',
42
+ oid: Number(request.query.oid),
43
+ number: Number(request.query.number),
44
+ type: Number(request.query.type ?? 1)
45
+ }, request.headers.cookie ?? cookie));
46
+ });
47
+ fastify.get('/fetch_emoji_list', async (_request, reply) => {
48
+ reply.type('application/json').send(await BilibiliData({
49
+ methodType: 'Emoji数据'
50
+ }));
51
+ });
52
+ fastify.get('/fetch_bangumi_video_info', async (request, reply) => {
53
+ reply.type('application/json').send(await BilibiliData({
54
+ methodType: '番剧基本信息数据',
55
+ ep_id: request.query.ep_id
56
+ }, request.headers.cookie ?? cookie));
57
+ });
58
+ fastify.get('/fetch_bangumi_video_playurl', async (request, reply) => {
59
+ reply.type('application/json').send(await BilibiliData({
60
+ methodType: '番剧下载信息数据',
61
+ cid: request.query.cid,
62
+ ep_id: request.query.ep_id
63
+ }, request.headers.cookie ?? cookie));
64
+ });
65
+ fastify.get('/fetch_user_dynamic', async (request, reply) => {
66
+ reply.type('application/json').send(await BilibiliData({
67
+ methodType: '用户主页动态列表数据',
68
+ host_mid: request.query.host_mid
69
+ }, request.headers.cookie ?? cookie));
70
+ });
71
+ fastify.get('/fetch_dynamic_info', async (request, reply) => {
72
+ reply.type('application/json').send(await BilibiliData({
73
+ methodType: '动态详情数据',
74
+ dynamic_id: request.query.dynamic_id
75
+ }, request.headers.cookie ?? cookie));
76
+ });
77
+ fastify.get('/fetch_dynamic_card', async (request, reply) => {
78
+ reply.type('application/json').send(await BilibiliData({
79
+ methodType: '动态卡片数据',
80
+ dynamic_id: request.query.dynamic_id
81
+ }, request.headers.cookie ?? cookie));
82
+ });
83
+ fastify.get('/fetch_user_profile', async (request, reply) => {
84
+ reply.type('application/json').send(await BilibiliData({
85
+ methodType: '用户主页数据',
86
+ host_mid: request.query.host_mid
87
+ }, request.headers.cookie ?? cookie));
88
+ });
89
+ fastify.get('/fetch_live_room_detail', async (request, reply) => {
90
+ reply.type('application/json').send(await BilibiliData({
91
+ methodType: '直播间信息',
92
+ room_id: request.query.room_id
93
+ }, request.headers.cookie ?? cookie));
94
+ });
95
+ fastify.get('/fetch_liveroom_def', async (request, reply) => {
96
+ reply.type('application/json').send(await BilibiliData({
97
+ methodType: '直播间初始化信息',
98
+ room_id: request.query.room_id
99
+ }, request.headers.cookie ?? cookie));
100
+ });
101
+ fastify.get('/bv_to_av', async (request, reply) => {
102
+ reply.type('application/json').send(await BilibiliData({
103
+ methodType: 'BV转AV',
104
+ bvid: request.query.bvid
105
+ }));
106
+ });
107
+ fastify.get('/av_to_bv', async (request, reply) => {
108
+ reply.type('application/json').send(await BilibiliData({
109
+ methodType: 'AV转BV',
110
+ avid: request.query.avid
111
+ }));
112
+ });
113
+ fastify.get('/fetch_user_full_view', async (request, reply) => {
114
+ reply.type('application/json').send(await BilibiliData({
115
+ methodType: '获取UP主总播放量',
116
+ host_mid: request.query.host_mid
117
+ }, request.headers.cookie ?? cookie));
118
+ });
119
+ }, { prefix: '/api/bilibili' });
120
+ };
@@ -1,4 +1,5 @@
1
1
  import { douyinAPI } from './API.js';
2
2
  import { DouyinData } from './getdata.js';
3
+ import { registerDouyinRoutes } from './routes.js';
3
4
  import douyinSign from './sign/index.js';
4
- export { douyinAPI, DouyinData, douyinSign };
5
+ export { douyinAPI, DouyinData, douyinSign, registerDouyinRoutes };
@@ -1,4 +1,5 @@
1
1
  import { douyinAPI } from './API.js';
2
2
  import { DouyinData } from './getdata.js';
3
+ import { registerDouyinRoutes } from './routes.js';
3
4
  import douyinSign from './sign/index.js';
4
- export { douyinAPI, DouyinData, douyinSign };
5
+ export { douyinAPI, DouyinData, douyinSign, registerDouyinRoutes };
@@ -0,0 +1,7 @@
1
+ import { FastifyInstance } from 'fastify';
2
+ /**
3
+ * 注册抖音相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export declare const registerDouyinRoutes: (fastify: FastifyInstance, cookie: string) => void;
@@ -0,0 +1,83 @@
1
+ import { DouyinData } from '../../platform/index.js';
2
+ /**
3
+ * 注册抖音相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export const registerDouyinRoutes = (fastify, cookie) => {
8
+ fastify.register(async (fastify) => {
9
+ await Promise.resolve();
10
+ fastify.get('/fetch_one_work', async (request, reply) => {
11
+ reply.type('application/json').send(await DouyinData({
12
+ methodType: '单个视频作品数据',
13
+ aweme_id: request.query.aweme_id
14
+ }, request.headers.cookie ?? cookie));
15
+ });
16
+ fastify.get('/fetch_work_comments', async (request, reply) => {
17
+ reply.type('application/json').send(await DouyinData({
18
+ methodType: '评论数据',
19
+ aweme_id: request.query.aweme_id
20
+ }, request.headers.cookie ?? cookie));
21
+ });
22
+ fastify.get('/fetch_video_comment_replies', async (request, reply) => {
23
+ reply.type('application/json').send(await DouyinData({
24
+ methodType: '二级评论数据',
25
+ aweme_id: request.query.aweme_id,
26
+ comment_id: request.query.comment_id
27
+ }, request.headers.cookie ?? cookie));
28
+ });
29
+ fastify.get('/fetch_user_info', async (request, reply) => {
30
+ reply.type('application/json').send(await DouyinData({
31
+ methodType: '用户主页数据',
32
+ sec_uid: request.query.sec_uid
33
+ }, request.headers.cookie ?? cookie));
34
+ });
35
+ fastify.get('/fetch_user_post_videos', async (request, reply) => {
36
+ reply.type('application/json').send(await DouyinData({
37
+ methodType: '用户主页视频列表数据',
38
+ sec_uid: request.query.sec_uid
39
+ }, request.headers.cookie ?? cookie));
40
+ });
41
+ fastify.get('/fetch_suggest_words', async (request, reply) => {
42
+ reply.type('application/json').send(await DouyinData({
43
+ methodType: '热点词数据',
44
+ query: request.query.query
45
+ }, request.headers.cookie ?? cookie));
46
+ });
47
+ fastify.get('/fetch_search_info', async (request, reply) => {
48
+ reply.type('application/json').send(await DouyinData({
49
+ methodType: '搜索数据',
50
+ query: request.query.query,
51
+ number: request.query.number
52
+ }, request.headers.cookie ?? cookie));
53
+ });
54
+ fastify.get('/fetch_emoji_list', async (request, reply) => {
55
+ reply.type('application/json').send(await DouyinData({
56
+ methodType: 'Emoji数据'
57
+ }, request.headers.cookie ?? cookie));
58
+ });
59
+ fastify.get('/fetch_emoji_pro_list', async (request, reply) => {
60
+ reply.type('application/json').send(await DouyinData({
61
+ methodType: '动态表情数据'
62
+ }, request.headers.cookie ?? cookie));
63
+ });
64
+ fastify.get('/fetch_music_work', async (request, reply) => {
65
+ reply.type('application/json').send(await DouyinData({
66
+ methodType: '音乐数据',
67
+ music_id: request.query.music_id
68
+ }, request.headers.cookie ?? cookie));
69
+ });
70
+ fastify.get('/fetch_user_mix_videos', async (request, reply) => {
71
+ reply.type('application/json').send(await DouyinData({
72
+ methodType: '合辑作品数据',
73
+ aweme_id: request.query.aweme_id
74
+ }, request.headers.cookie ?? cookie));
75
+ });
76
+ fastify.get('/fetch_user_live_videos', async (request, reply) => {
77
+ reply.type('application/json').send(await DouyinData({
78
+ methodType: '直播间信息数据',
79
+ sec_uid: request.query.sec_uid
80
+ }, request.headers.cookie ?? cookie));
81
+ });
82
+ }, { prefix: '/api/douyin' });
83
+ };
@@ -1,3 +1,4 @@
1
1
  import { KuaishouAPI } from './API.js';
2
2
  import { KuaishouData } from './getdata.js';
3
- export { KuaishouAPI, KuaishouData };
3
+ import { registerKuaishouRoutes } from './routes.js';
4
+ export { KuaishouAPI, KuaishouData, registerKuaishouRoutes };
@@ -1,3 +1,4 @@
1
1
  import { KuaishouAPI } from './API.js';
2
2
  import { KuaishouData } from './getdata.js';
3
- export { KuaishouAPI, KuaishouData };
3
+ import { registerKuaishouRoutes } from './routes.js';
4
+ export { KuaishouAPI, KuaishouData, registerKuaishouRoutes };
@@ -0,0 +1,7 @@
1
+ import { FastifyInstance } from 'fastify';
2
+ /**
3
+ * 注册快手相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export declare const registerKuaishouRoutes: (fastify: FastifyInstance, cookie: string) => void;
@@ -0,0 +1,28 @@
1
+ import { KuaishouData } from '../../platform/index.js';
2
+ /**
3
+ * 注册快手相关的API接口路由
4
+ * @param fastify - fastify 实例
5
+ * @param cookie - 有效的cookie
6
+ */
7
+ export const registerKuaishouRoutes = (fastify, cookie) => {
8
+ fastify.register(async (fastify) => {
9
+ await Promise.resolve();
10
+ fastify.get('/fetch_one_work', async (request, reply) => {
11
+ reply.type('application/json').send(await KuaishouData({
12
+ methodType: '单个视频作品数据',
13
+ photoId: request.query.photoId
14
+ }, request.headers.cookie ?? cookie));
15
+ });
16
+ fastify.get('/fetch_work_comments', async (request, reply) => {
17
+ reply.type('application/json').send(await KuaishouData({
18
+ methodType: '评论数据',
19
+ photoId: request.query.photoId
20
+ }, request.headers.cookie ?? cookie));
21
+ });
22
+ fastify.get('/fetch_emoji_list', async (request, reply) => {
23
+ reply.type('application/json').send(await KuaishouData({
24
+ methodType: 'Emoji数据'
25
+ }, request.headers.cookie ?? cookie));
26
+ });
27
+ }, { prefix: '/api/kuaishou' });
28
+ };
@@ -1,5 +1,5 @@
1
1
  import { BilibiliDataOptions, BilibiliDataOptionsMap, DouyinDataOptions, DouyinDataOptionsMap, KuaishouDataOptions, KuaishouDataOptionsMap } from '../types/index.js';
2
- export type initClientParams = {
2
+ export type ckParams = {
3
3
  /**
4
4
  * 抖音ck
5
5
  * @defaultValue ''
@@ -22,13 +22,13 @@ export declare class amagi {
22
22
  private kuaishou;
23
23
  /**
24
24
  *
25
- * @param data - 一个对象,里面包含 douyin 和 bilibili 两个字段,分别对应抖音和B站cookie
25
+ * @param cookie - 包含抖音ck、B站ck、快手ck的对象
26
26
  */
27
- constructor(data: initClientParams);
27
+ constructor(data: ckParams);
28
28
  /**
29
29
  * 启动本地http服务
30
30
  * @param port - 监听端口
31
- * @defaultValue port 4567
31
+ * @defaultValue `port` 4567
32
32
  * @returns
33
33
  */
34
34
  startClient(port?: number): import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
@@ -1,7 +1,5 @@
1
- import { logger } from '../model/index.js';
2
- import { getBilibiliData, getDouyinData, getKuaishouData } from '../model/DataFetchers.js';
3
- import { DouyinData, KuaishouData } from '../platform/index.js';
4
- import { BilibiliData } from '../platform/bilibili/index.js';
1
+ import { getBilibiliData, getDouyinData, getKuaishouData, logger } from '../model/index.js';
2
+ import { registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes } from '../platform/index.js';
5
3
  import Fastify from 'fastify';
6
4
  export class amagi {
7
5
  douyin;
@@ -9,20 +7,17 @@ export class amagi {
9
7
  kuaishou;
10
8
  /**
11
9
  *
12
- * @param data - 一个对象,里面包含 douyin 和 bilibili 两个字段,分别对应抖音和B站cookie
10
+ * @param cookie - 包含抖音ck、B站ck、快手ck的对象
13
11
  */
14
12
  constructor(data) {
15
- /** 抖音ck */
16
13
  this.douyin = data.douyin ?? '';
17
- /** B站ck */
18
14
  this.bilibili = data.bilibili ?? '';
19
- /** 快手ck */
20
15
  this.kuaishou = data.kuaishou ?? '';
21
16
  }
22
17
  /**
23
18
  * 启动本地http服务
24
19
  * @param port - 监听端口
25
- * @defaultValue port 4567
20
+ * @defaultValue `port` 4567
26
21
  * @returns
27
22
  */
28
23
  startClient(port = 4567) {
@@ -45,204 +40,9 @@ export class amagi {
45
40
  Client.get('/docs', async (_request, reply) => {
46
41
  reply.redirect('https://amagi.apifox.cn', 301);
47
42
  });
48
- Client.get('/api/douyin/fetch_one_work', async (request, reply) => {
49
- reply.type('application/json').send(await DouyinData({
50
- methodType: '单个视频作品数据',
51
- aweme_id: request.query.aweme_id
52
- }, this.douyin));
53
- });
54
- Client.get('/api/douyin/fetch_work_comments', async (request, reply) => {
55
- reply.type('application/json').send(await DouyinData({
56
- methodType: '评论数据',
57
- aweme_id: request.query.aweme_id
58
- }, this.douyin));
59
- });
60
- Client.get('/api/douyin/fetch_video_comment_replies', async (request, reply) => {
61
- reply.type('application/json').send(await DouyinData({
62
- methodType: '二级评论数据',
63
- aweme_id: request.query.aweme_id,
64
- comment_id: request.query.comment_id
65
- }, this.douyin));
66
- });
67
- Client.get('/api/douyin/fetch_user_info', async (request, reply) => {
68
- reply.type('application/json').send(await DouyinData({
69
- methodType: '用户主页数据',
70
- sec_uid: request.query.sec_uid
71
- }, this.douyin));
72
- });
73
- Client.get('/api/douyin/fetch_user_post_videos', async (request, reply) => {
74
- reply.type('application/json').send(await DouyinData({
75
- methodType: '用户主页视频列表数据',
76
- sec_uid: request.query.sec_uid
77
- }, this.douyin));
78
- });
79
- Client.get('/api/douyin/fetch_suggest_words', async (request, reply) => {
80
- reply.type('application/json').send(await DouyinData({
81
- methodType: '热点词数据',
82
- query: request.query.query
83
- }, this.douyin));
84
- });
85
- Client.get('/api/douyin/fetch_search_info', async (request, reply) => {
86
- reply.type('application/json').send(await DouyinData({
87
- methodType: '搜索数据',
88
- query: request.query.query,
89
- number: request.query.number
90
- }, this.douyin));
91
- });
92
- Client.get('/api/douyin/fetch_emoji_list', async (_request, reply) => {
93
- reply.type('application/json').send(await DouyinData({
94
- methodType: 'Emoji数据'
95
- }, this.douyin));
96
- });
97
- Client.get('/api/douyin/fetch_emoji_pro_list', async (_request, reply) => {
98
- reply.type('application/json').send(await DouyinData({
99
- methodType: '动态表情数据'
100
- }, this.douyin));
101
- });
102
- Client.get('/api/douyin/fetch_music_work', async (request, reply) => {
103
- reply.type('application/json').send(await DouyinData({
104
- methodType: '音乐数据',
105
- music_id: request.query.music_id
106
- }, this.douyin));
107
- });
108
- Client.get('/api/douyin/fetch_user_mix_videos', async (request, reply) => {
109
- reply.type('application/json').send(await DouyinData({
110
- methodType: '合辑作品数据',
111
- aweme_id: request.query.aweme_id
112
- }, this.douyin));
113
- });
114
- Client.get('/api/douyin/fetch_user_live_videos', async (request, reply) => {
115
- reply.type('application/json').send(await DouyinData({
116
- methodType: '直播间信息数据',
117
- sec_uid: request.query.sec_uid
118
- }, this.douyin));
119
- });
120
- Client.get('/api/bilibili/new_login_qrcode', async (request, reply) => {
121
- reply.type('application/json').send(await BilibiliData({
122
- methodType: '申请二维码'
123
- }));
124
- });
125
- Client.get('/api/bilibili/check_qrcode', async (request, reply) => {
126
- reply.type('application/json').send(await BilibiliData({
127
- methodType: '二维码状态',
128
- qrcode_key: request.query.qrcode_key
129
- }));
130
- });
131
- Client.get('/api/bilibili/login_basic_info', async (request, reply) => {
132
- reply.type('application/json').send(await BilibiliData({
133
- methodType: '登录基本信息'
134
- }, request.headers.cookie));
135
- });
136
- Client.get('/api/bilibili/fetch_one_video', async (request, reply) => {
137
- reply.type('application/json').send(await BilibiliData({
138
- methodType: '单个视频作品数据',
139
- bvid: request.query.bvid
140
- }, this.bilibili));
141
- });
142
- Client.get('/api/bilibili/fetch_video_playurl', async (request, reply) => {
143
- reply.type('application/json').send(await BilibiliData({
144
- methodType: '单个视频下载信息数据',
145
- avid: request.query.avid,
146
- cid: request.query.cid
147
- }, this.bilibili));
148
- });
149
- Client.get('/api/bilibili/fetch_work_comments', async (request, reply) => {
150
- reply.type('application/json').send(await BilibiliData({
151
- methodType: '评论数据',
152
- oid: Number(request.query.oid),
153
- number: Number(request.query.number),
154
- type: Number(request.query.type ?? 1)
155
- }, this.bilibili));
156
- });
157
- Client.get('/api/bilibili/fetch_emoji_list', async (_request, reply) => {
158
- reply.type('application/json').send(await BilibiliData({
159
- methodType: 'Emoji数据'
160
- }));
161
- });
162
- Client.get('/api/bilibili/fetch_bangumi_video_info', async (request, reply) => {
163
- reply.type('application/json').send(await BilibiliData({
164
- methodType: '番剧基本信息数据',
165
- ep_id: request.query.ep_id
166
- }, this.bilibili));
167
- });
168
- Client.get('/api/bilibili/fetch_bangumi_video_playurl', async (request, reply) => {
169
- reply.type('application/json').send(await BilibiliData({
170
- methodType: '番剧下载信息数据',
171
- cid: request.query.cid,
172
- ep_id: request.query.ep_id
173
- }, this.bilibili));
174
- });
175
- Client.get('/api/bilibili/fetch_user_dynamic', async (request, reply) => {
176
- reply.type('application/json').send(await BilibiliData({
177
- methodType: '用户主页动态列表数据',
178
- host_mid: request.query.host_mid
179
- }, this.bilibili));
180
- });
181
- Client.get('/api/bilibili/fetch_dynamic_info', async (request, reply) => {
182
- reply.type('application/json').send(await BilibiliData({
183
- methodType: '动态详情数据',
184
- dynamic_id: request.query.dynamic_id
185
- }, this.bilibili));
186
- });
187
- Client.get('/api/bilibili/fetch_dynamic_card', async (request, reply) => {
188
- reply.type('application/json').send(await BilibiliData({
189
- methodType: '动态卡片数据',
190
- dynamic_id: request.query.dynamic_id
191
- }, this.bilibili));
192
- });
193
- Client.get('/api/bilibili/fetch_user_profile', async (request, reply) => {
194
- reply.type('application/json').send(await BilibiliData({
195
- methodType: '用户主页数据',
196
- host_mid: request.query.host_mid
197
- }, this.bilibili));
198
- });
199
- Client.get('/api/bilibili/fetch_live_room_detail', async (request, reply) => {
200
- reply.type('application/json').send(await BilibiliData({
201
- methodType: '直播间信息',
202
- room_id: request.query.room_id
203
- }, this.bilibili));
204
- });
205
- Client.get('/api/bilibili/fetch_liveroom_def', async (request, reply) => {
206
- reply.type('application/json').send(await BilibiliData({
207
- methodType: '直播间初始化信息',
208
- room_id: request.query.room_id
209
- }, this.bilibili));
210
- });
211
- Client.get('/api/bilibili/bv_to_av', async (request, reply) => {
212
- reply.type('application/json').send(await BilibiliData({
213
- methodType: 'BV转AV',
214
- bvid: request.query.bvid
215
- }, this.bilibili));
216
- });
217
- Client.get('/api/bilibili/av_to_bv', async (request, reply) => {
218
- reply.type('application/json').send(await BilibiliData({
219
- methodType: 'AV转BV',
220
- avid: request.query.avid
221
- }, this.bilibili));
222
- });
223
- Client.get('/api/bilibili/fetch_user_full_view', async (request, reply) => {
224
- reply.type('application/json').send(await BilibiliData({
225
- methodType: '获取UP主总播放量',
226
- host_mid: request.query.host_mid
227
- }, this.bilibili));
228
- });
229
- Client.get('/api/kuaishou/fetch_one_work', async (request, reply) => {
230
- reply.type('application/json').send(await KuaishouData({
231
- methodType: '单个视频作品数据',
232
- photoId: request.query.photoId
233
- }, this.kuaishou));
234
- });
235
- Client.get('/api/kuaishou/fetch_work_comments', async (request, reply) => {
236
- reply.type('application/json').send(await KuaishouData({
237
- methodType: '评论数据',
238
- photoId: request.query.photoId
239
- }, this.kuaishou));
240
- });
241
- Client.get('/api/kuaishou/fetch_emoji_list', async (request, reply) => {
242
- reply.type('application/json').send(await KuaishouData({
243
- methodType: 'Emoji数据'
244
- }, this.kuaishou));
245
- });
43
+ registerDouyinRoutes(Client, this.douyin);
44
+ registerBilibiliRoutes(Client, this.bilibili);
45
+ registerKuaishouRoutes(Client, this.kuaishou);
246
46
  Client.listen({ port, host: '::' }, (_err, _address) => {
247
47
  if (_err)
248
48
  Client.log.error(_err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikenxuan/amagi",
3
- "version": "4.1.1",
3
+ "version": "4.2.2",
4
4
  "description": "抖音、B站的 web 端相关数据接口基于 Node.js 的实现",
5
5
  "keywords": [
6
6
  "douyin",