#bilibili #api #api-client #data #user #got #inspiration

bilibili-api-rs

A rust library project got inspiration from Passkou/bilibili-api

11 releases

0.3.5 Jan 13, 2024
0.3.4 Oct 13, 2023
0.3.2 Jul 5, 2023
0.2.3 Mar 12, 2022
0.1.0 Jun 23, 2021

#168 in HTTP client

26 downloads per month

WTFPL license

29KB
626 lines

bilibili-api-rs

crates license docs Gitmoji

A rust library project got inspiration from bilibili-api.

  • No plan for cover all apis.
  • "GET" like api only.

Design

data:

  • api
    • user::{info, channel_series}, video::info, xlive::info

code:

  • root: exports
    • wbi: access(path, querymap, respschema)
      • wrapper user, xlive etc

License

WTFPL


lib.rs:

bilibili-api-rs is a rust library project got inspiration from bilibili-api.

Currently "GET" apis only. Api interface User, Xlive derive from Client.

Api result is part of response, alike bilibili-api, is response["data"]. Invalid response treated as error then bail. Note that init retries and token refresh also be treated as error.

High overhead: to anti-detect, client open one whole new connection in every request.

Example

use bilibili_api_rs::Client;
use anyhow::Result;
async fn test_xlive() -> Result<()> {
    let mut cli = Client::new();
    let area_virtual = 9;
    let type_all = 0;
    cli.xlive(area_virtual, type_all).list(1).await.ok(); // usually retry once for init
    let lives = cli.xlive(area_virtual, type_all).list(2).await?;
    Ok(())
}

Dependencies

~10–25MB
~370K SLoC