show_basic_video_info/
show_basic_video_info.rs1use std::error::Error;
2
3use serde_json::Value;
4use tokio::fs;
5use ybd_core::{client::BiliClient, login, url::VIDEO_INFO};
6
7#[tokio::main]
8async fn main() -> Result<(), Box<dyn Error>> {
9 let account = login::get_account().await?;
10 let biliclient = BiliClient::new(&account)?;
11 let resp: Value = biliclient
12 .get(VIDEO_INFO)
13 .header("Referer", "https://www.bilibili.com")
14 .query(&[("bvid", "BV1bzLy6EEbn")])
15 .send()
16 .await?
17 .json()
18 .await?;
19 fs::create_dir_all("./output").await?;
20 let s = serde_json::to_string_pretty(&resp)?;
21 fs::write("output/basic_video_info.json", s).await?;
22 println!("结果输出至output/basic_video_info.json");
23 Ok(())
24}