Crates.io | actix-bililive |
lib.rs | actix-bililive |
version | 0.1.0-beta.8 |
source | src |
created_at | 2021-10-31 14:19:31.778651 |
updated_at | 2022-03-10 16:59:01.467357 |
description | A simple stream-based bilibili live client library for the Actix ecosystem. |
homepage | |
repository | https://github.com/PhotonQuantum/bililive-rs |
max_upload_size | |
id | 474740 |
size | 58,622 |
A simple stream-based bilibili live client library for the Actix ecosystem.
Minimum supported rust version: 1.56.0
This crate supports actix-rt
(single-threaded tokio
) runtime.
Stream
/Sink
interface.Zlib
payloads automatically.use actix_bililive::{ConfigBuilder, RetryConfig, connect_with_retry};
use futures::StreamExt;
use log::info;
use serde_json::Value;
let config = ConfigBuilder::new()
.by_uid(1602085)
.await
.unwrap()
.fetch_conf()
.await
.unwrap()
.build();
let mut stream = connect_with_retry(config, RetryConfig::default()).await.unwrap();
while let Some(e) = stream.next().await {
match e {
Ok(packet) => {
info!("raw: {:?}", packet);
if let Ok(json) = packet.json::<Value>() {
info!("json: {:?}", json);
}
}
Err(e) => {
info!("err: {:?}", e);
}
}
}