bililive-rs

GitHub Workflow Status crates.io Documentation

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

Example

```rust use bililive::connect::tokio::connectwithretry; use bililive::{ConfigBuilder, RetryConfig};

use futures::StreamExt; use log::info; use serde_json::Value;

let config = ConfigBuilder::new() .byuid(1602085) .await .unwrap() .fetchconf() .await .unwrap() .build();

let mut stream = connectwithretry(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::() { info!("json: {:?}", json); } } Err(e) => { info!("err: {:?}", e); } } } ```

Crate Features