floating-live 0.15.0-beta.0 → 0.15.0-beta.1
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 +3 -34
- package/dist/core/LiveRoom.d.ts +0 -2
- package/dist/live.d.ts +0 -3
- package/dist/live.js +0 -2
- package/dist/module/ModRoom.d.ts +0 -2
- package/dist/module/ModRoom.js +0 -9
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/package.json +8 -15
- package/dist/module/ModAuth.d.ts +0 -10
- package/dist/module/ModAuth.js +0 -35
- package/dist/types/auth.d.ts +0 -19
- package/dist/types/auth.js +0 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Floating Live
|
|
2
2
|
一个用于处理和保存直播弹幕的Node.js小工具,开箱即用。
|
|
3
3
|
|
|
4
|
+
本体无弹幕获取功能,需要配合[floating-live-danmaku](https://github.com/Minteea/floating-live-danmaku)中的弹幕获取插件使用。
|
|
5
|
+
|
|
4
6
|
目前支持bilibili和AcFun的直播弹幕,不同平台的弹幕会转换为同一种格式便于保存。
|
|
5
7
|
|
|
6
8
|
项目仍在开发中,功能尚未完善,目前除了记录保存直播弹幕外暂时没有别的用处啦,敬请期待。
|
|
@@ -18,7 +20,7 @@ npm install floating-live
|
|
|
18
20
|
// 导入FloatingLive
|
|
19
21
|
const { FloatingLive } = require("floating-live")
|
|
20
22
|
// 导入bilibili房间生成插件
|
|
21
|
-
const bilibili = require("floating-live/plugin
|
|
23
|
+
const bilibili = require("@floating-live/bilibili/plugin")
|
|
22
24
|
|
|
23
25
|
// 创建一个FloatingLive实例
|
|
24
26
|
const live = new FloatingLive()
|
|
@@ -28,36 +30,3 @@ live.plugin.register(bilibili)
|
|
|
28
30
|
// 添加房间并自动打开
|
|
29
31
|
live.room.add("bilibili", 6, true)
|
|
30
32
|
```
|
|
31
|
-
|
|
32
|
-
### 拆包即用模式
|
|
33
|
-
* 下载并安装 `Node.js` ,建议下载最新LTS版本(如果已经安装可跳过这一步)。
|
|
34
|
-
* 下载该项目的zip压缩包,解压,并在项目根目录下新建一个名为 `save` 的文件夹。
|
|
35
|
-
* 在项目根目录的控制台输入下列命令,安装所有依赖包。
|
|
36
|
-
```
|
|
37
|
-
npm install
|
|
38
|
-
```
|
|
39
|
-
#### 运行Demo文件
|
|
40
|
-
* 打开demo/demo.ts
|
|
41
|
-
``` typescript
|
|
42
|
-
// ...
|
|
43
|
-
const config = {
|
|
44
|
-
rooms: [
|
|
45
|
-
{
|
|
46
|
-
platform: "bilibili", // 直播平台
|
|
47
|
-
id: 2064239, // 直播间号
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
51
|
-
// ...
|
|
52
|
-
```
|
|
53
|
-
* 根据需要修改直播平台和直播间号,目前支持的 `platform` 值有:`acfun`、`bilibili`(注意是小写),也可以通过自定义插件添加直播平台
|
|
54
|
-
* 在项目根目录的控制台输入下列命令:
|
|
55
|
-
```
|
|
56
|
-
npm run test
|
|
57
|
-
```
|
|
58
|
-
即可接收来自平台的直播弹幕。
|
|
59
|
-
|
|
60
|
-
## 感谢
|
|
61
|
-
### 使用开源库
|
|
62
|
-
* [simon300000/bilibili-live-ws](https://github.com/simon300000/bilibili-live-ws/)
|
|
63
|
-
* [ACFUN-FOSS/ac-danmu](https://github.com/ACFUN-FOSS/ac-danmu.js)
|
package/dist/core/LiveRoom.d.ts
CHANGED
|
@@ -33,8 +33,6 @@ export declare abstract class LiveRoom extends EventEmitter implements RoomInfo
|
|
|
33
33
|
abstract close(): void;
|
|
34
34
|
/** 从服务器获取信息 */
|
|
35
35
|
abstract getInfo(): Promise<void>;
|
|
36
|
-
/** 设置用户凭据 */
|
|
37
|
-
setAuth?(auth: string): void;
|
|
38
36
|
/** 销毁事件 */
|
|
39
37
|
protected onDestory?(): void;
|
|
40
38
|
/** 销毁 */
|
package/dist/live.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { EventEmitter } from "events";
|
|
3
3
|
import { ModPlugin } from "./module/ModPlugin";
|
|
4
4
|
import { ModRoom } from "./module/ModRoom";
|
|
5
|
-
import { ModAuth } from "./module/ModAuth";
|
|
6
5
|
import { ModMessage } from "./module/ModMessage";
|
|
7
6
|
import { ModState } from "./module/ModState";
|
|
8
7
|
import ModCommand from "./module/ModCommand";
|
|
@@ -11,8 +10,6 @@ export declare class FloatingLive extends EventEmitter {
|
|
|
11
10
|
room: ModRoom;
|
|
12
11
|
/** 消息处理模块 */
|
|
13
12
|
message: ModMessage;
|
|
14
|
-
/** 用户登录凭据模块 */
|
|
15
|
-
auth: ModAuth;
|
|
16
13
|
/** 插件处理模块 */
|
|
17
14
|
plugin: ModPlugin<this>;
|
|
18
15
|
/** 命令模块 */
|
package/dist/live.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.FloatingLive = void 0;
|
|
|
7
7
|
const events_1 = require("events");
|
|
8
8
|
const ModPlugin_1 = require("./module/ModPlugin");
|
|
9
9
|
const ModRoom_1 = require("./module/ModRoom");
|
|
10
|
-
const ModAuth_1 = require("./module/ModAuth");
|
|
11
10
|
const ModMessage_1 = require("./module/ModMessage");
|
|
12
11
|
const ModState_1 = require("./module/ModState");
|
|
13
12
|
const ModCommand_1 = __importDefault(require("./module/ModCommand"));
|
|
@@ -21,7 +20,6 @@ class FloatingLive extends events_1.EventEmitter {
|
|
|
21
20
|
this.plugin = new ModPlugin_1.ModPlugin(this);
|
|
22
21
|
this.room = new ModRoom_1.ModRoom(this);
|
|
23
22
|
this.message = new ModMessage_1.ModMessage(this);
|
|
24
|
-
this.auth = new ModAuth_1.ModAuth(this);
|
|
25
23
|
this.init();
|
|
26
24
|
}
|
|
27
25
|
/** 初始化 */
|
package/dist/module/ModRoom.d.ts
CHANGED
|
@@ -10,8 +10,6 @@ export declare class ModRoom {
|
|
|
10
10
|
private configs;
|
|
11
11
|
generator: Reglist<(id: string | number, open?: boolean, config?: object) => LiveRoom>;
|
|
12
12
|
constructor(main: FloatingLive);
|
|
13
|
-
/** 设置登录凭据 */
|
|
14
|
-
setAuth(platform: string, auth: string): void;
|
|
15
13
|
/** 设置房间配置 */
|
|
16
14
|
setConfig(platform: string, config: any): void;
|
|
17
15
|
/** 生成房间 */
|
package/dist/module/ModRoom.js
CHANGED
|
@@ -35,15 +35,6 @@ class ModRoom {
|
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
/** 设置登录凭据 */
|
|
39
|
-
setAuth(platform, auth) {
|
|
40
|
-
this.auths.set(platform, auth);
|
|
41
|
-
this.roomMap.forEach((room) => {
|
|
42
|
-
if (room.platform == platform) {
|
|
43
|
-
room.setAuth?.(auth);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
38
|
/** 设置房间配置 */
|
|
48
39
|
setConfig(platform, config) {
|
|
49
40
|
this.configs.set(platform, config);
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "floating-live",
|
|
3
|
-
"version": "0.15.0-beta.
|
|
3
|
+
"version": "0.15.0-beta.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,8 +20,12 @@
|
|
|
20
20
|
"require": "./dist/types/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./enums": {
|
|
23
|
-
"types": "./dist/
|
|
24
|
-
"require": "./dist/
|
|
23
|
+
"types": "./dist/enums.d.ts",
|
|
24
|
+
"require": "./dist/enums.js"
|
|
25
|
+
},
|
|
26
|
+
"./utils": {
|
|
27
|
+
"types": "./dist/utils.d.ts",
|
|
28
|
+
"require": "./dist/utils.js"
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
31
|
"scripts": {
|
|
@@ -32,18 +36,7 @@
|
|
|
32
36
|
"build": "npm run clear && npm run tsc",
|
|
33
37
|
"prepare": "npm run build"
|
|
34
38
|
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@types/qrcode": "^1.5.2",
|
|
37
|
-
"acfun-live-danmaku": "^0.6.1",
|
|
38
|
-
"axios": "^1.4.0",
|
|
39
|
-
"bilibili-live-ws": "^6.3.1",
|
|
40
|
-
"fs-extra": "^11.1.0",
|
|
41
|
-
"qrcode": "^1.5.3"
|
|
42
|
-
},
|
|
43
39
|
"devDependencies": {
|
|
44
|
-
"@types/fs-extra": "^9.0.13",
|
|
45
|
-
"@types/websocket": "^1.0.5",
|
|
46
|
-
"@types/ws": "^8.5.3",
|
|
47
40
|
"rimraf": "^3.0.2",
|
|
48
41
|
"ts-node": "^10.9.1",
|
|
49
42
|
"typescript": "^4.8.4"
|
|
@@ -51,4 +44,4 @@
|
|
|
51
44
|
"peerDependencies": {
|
|
52
45
|
"events": "^3.3.0"
|
|
53
46
|
}
|
|
54
|
-
}
|
|
47
|
+
}
|
package/dist/module/ModAuth.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Reglist } from "../core/Reglist";
|
|
2
|
-
import { FloatingLive } from "../live";
|
|
3
|
-
import { AuthOptions } from "../types/auth";
|
|
4
|
-
export declare class ModAuth {
|
|
5
|
-
options: Reglist<AuthOptions>;
|
|
6
|
-
status: Record<string, string | number>;
|
|
7
|
-
main: FloatingLive;
|
|
8
|
-
constructor(main: FloatingLive);
|
|
9
|
-
set(name: string, auth: string): void;
|
|
10
|
-
}
|
package/dist/module/ModAuth.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModAuth = void 0;
|
|
4
|
-
const Reglist_1 = require("../core/Reglist");
|
|
5
|
-
class ModAuth {
|
|
6
|
-
constructor(main) {
|
|
7
|
-
this.status = {};
|
|
8
|
-
this.options = new Reglist_1.Reglist(main, "auth.options");
|
|
9
|
-
this.main = main;
|
|
10
|
-
this.main.state.register("auth", () => {
|
|
11
|
-
const options = {};
|
|
12
|
-
this.options.forEach((val, key) => {
|
|
13
|
-
options[key] = val;
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
options: options,
|
|
17
|
-
status: this.status,
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
this.main.command.batchRegister({
|
|
21
|
-
auth: (platform, auth) => {
|
|
22
|
-
if (this.main.command.has(`auth.${platform}`)) {
|
|
23
|
-
this.main.command.execute(`auth.${platform}`, auth);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.set(platform, auth);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
set(name, auth) {
|
|
32
|
-
this.main.room.setAuth(name, auth);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.ModAuth = ModAuth;
|
package/dist/types/auth.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface AuthOptions {
|
|
2
|
-
/** 直接输入凭证 */
|
|
3
|
-
auth: {
|
|
4
|
-
/** 凭证类型 */
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
/** 二维码登录 */
|
|
8
|
-
qrcode?: {
|
|
9
|
-
/** 二维码类型 */
|
|
10
|
-
type: "url" | "base64";
|
|
11
|
-
};
|
|
12
|
-
/** 验证码登录 */
|
|
13
|
-
verify?: {
|
|
14
|
-
/** 验证码发送等待间隔(秒) */
|
|
15
|
-
wait: number;
|
|
16
|
-
/** 第三方验证接口 */
|
|
17
|
-
captcha?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
package/dist/types/auth.js
DELETED