bililive-rs
A simple stream-based bilibili live client library backed by async-tungstenite.
To use with your project, add the following to your Cargo.toml:
bililive = "0.2.0-beta.1"
Minimum supported rust version: 1.56.0
Runtime Support
This crate supports both tokio and async-std runtime.
tokio support is enabled by default. While used on an async-std runtime, change the corresponding dependency in
Cargo.toml to
bililive = { version = "0.2.0-beta.1", default-features = false, features = ["async-native-tls"] }
See Crates Features section for more.
Features
- Ergonomic
Stream/Sinkinterface. - Easy establishment of connection via given live room id.
- Handles heartbeat packets automatically.
- Auto retry when connection fails (optional).
- Decompresses
Zlibpayloads automatically.
Example
use connect_with_retry;
use ;
use StreamExt;
use info;
use Value;
let config = new
.by_uid
.await
.unwrap
.fetch_conf
.await
.unwrap
.build;
let mut stream = connect_with_retry.await.unwrap;
while let Some = stream.next.await
Crate Features
tokio-native-tls(default): Enablestokiosupport with TLS implemented via tokio-native-tls.tokio-rustls-native-certs: Enablestokiosupport with TLS implemented via tokio-rustls and uses native system certificates found with rustls-native-certs.tokio-rustls-webpki-roots: Enablestokiosupport with TLS implemented via tokio-rustls and uses the certificates webpki-roots provides.async-native-tls: Enablesasync_stdsupport with TLS implemented via async-native-tls.