https://github.com/eatradish/felgens
Bilibili live danmu websocket library
https://github.com/eatradish/felgens
bilibili-live rust websocket
Last synced: over 1 year ago
JSON representation
Bilibili live danmu websocket library
- Host: GitHub
- URL: https://github.com/eatradish/felgens
- Owner: eatradish
- License: mit
- Created: 2022-11-27T12:11:36.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T04:52:43.000Z (about 3 years ago)
- Last Synced: 2025-03-02T00:38:22.944Z (over 1 year ago)
- Topics: bilibili-live, rust, websocket
- Language: Rust
- Homepage:
- Size: 76.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# felgens
Bilibili live danmu websocket library
[](https://asciinema.org/a/zQIlXtbOQCIzlghjDxpaBbcHJ)
## Usage
```rust
use anyhow::Result;
use felgens::{ws_socket_object, WsStreamMessageType};
use tokio::sync::mpsc::{self, UnboundedReceiver};
#[tokio::main]
async fn main() {
let (tx, rx) = mpsc::unbounded_channel();
// bilibili live room id (true id): 22746343
let ws = ws_socket_object(tx, 22746343);
if let Err(e) = tokio::select! {v = ws => v, v = recv(rx) => v} {
eprintln!("{}", e);
}
}
async fn recv(mut rx: UnboundedReceiver) -> Result<()> {
while let Some(msg) = rx.recv().await {
println!("{:?}", msg);
}
Ok(())
}
```
Or run `cargo run --example danmu`
## To-do!
- [x] 弹幕
- [x] SC
- [x] xxx 进了该房间
- [ ] 礼物
- [ ] 红包