show_video_info/
show_video_info.rs1use std::error::Error;
2
3use ybd_core::{client::BiliClient, login, model::video::PlayUrlResponse, util::extract_bv_id};
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn Error>> {
6 let account = login::get_account().await?;
7 let bili_client = BiliClient::new(&account)?;
8 let bvid = extract_bv_id(
9 "https://www.bilibili.com/video/BV17W411e7VL/?spm_id_from=333.337.search-card.all.click&vd_source=8bd37d9aaf81178ae3e80214a1c8e367",
10 )?;
11 let resp = PlayUrlResponse::new(&bili_client, &bvid).await?;
12
13 let json_str = serde_json::to_string_pretty(&resp)?;
14 tokio::fs::create_dir_all("output").await?;
15 tokio::fs::write("output/video_example.json", json_str).await?;
16 println!("The res is outputed to output/video_example.json");
17 Ok(())
18}