bilibili 开放平台 第三方SDK
说明
该项目由个人维护,如果接口有变更,您可以使用github提交pr,或给我发邮件。我会尽可能的维护该项目
如果你熟悉github和Rust,你应该知道怎么找我
使用方法
参见 examples 文件夹下的两个项目以及测试用例
请求接口部分
pub use bilibili_sdk::{
ResponseData, Data, GameInfo, WebsocketInfo, AnchorInfo, BilibiliSDK, Config };
use bilibili_sdk::{};
let config: Config = Config {
access_secret_key: "xxxxxxxxxx".to_owned(), access_key_id: "xxxxxxxxxx".to_owned(), ..Default::default()
};
let app_id: u64 = 1234567890123;let code: String = "xxxxxxxxx".to_owned();let sdk = BilibiliSDK::new(config);
let game_id = "abc".to_string();
async {
let result = sdk.start(code, app_id).await; let result = sdk.heartbeat(game_id.clone()).await; let result = sdk.batch_heartbeat(vec![game_id.clone()]).await; let result = sdk.end(app_id, game_id.clone()).await; };
proto 解析
use bilibili_sdk::{
Proto, Operation, num_2_operation };
use bilibili_sdk::{
LiveEventData, DM, SendGift, SuperChat, SuperChatDelete, Guard, Like, ComboInfo, LiveCmd, MatchedData, msg_parser };
let heartbeat = Proto::pack(None,Operation::Heartbeat,vec![]);
let auth = Proto::pack(None,Operation::Auth,vec![]);
let data : Vec<u8> = vec![0, 0, 0, 21, 0, 16, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 104, 101, 108, 108, 111].to_vec();
let proto = Proto::unpack(None, data);