pub struct VideoRequestParamBuilder { /* private fields */ }Implementations§
Source§impl VideoRequestParamBuilder
impl VideoRequestParamBuilder
Sourcepub async fn new(bvid: &str, bili_client: &BiliClient) -> Result<Self>
pub async fn new(bvid: &str, bili_client: &BiliClient) -> Result<Self>
Examples found in repository?
examples/show_video_info_raw.rs (line 16)
10async fn main() -> Result<(), Box<dyn Error>> {
11 let account = login::get_account().await?;
12 let bili_client = BiliClient::new(&account)?;
13 let bvid = extract_bv_id(
14 "https://www.bilibili.com/video/BV17W411e7VL/?spm_id_from=333.337.search-card.all.click&vd_source=8bd37d9aaf81178ae3e80214a1c8e367",
15 )?;
16 let vrp = VideoRequestParamBuilder::new(&bvid, &bili_client)
17 .await?
18 .build(&bili_client)
19 .await?;
20 let url = format!("{}?{}", VIDEO_DOWNLOAD_URL, vrp.to_query_string());
21 let resp: Value = bili_client.get(&url).send().await?.json().await?;
22
23 let json_str = serde_json::to_string_pretty(&resp)?;
24 tokio::fs::create_dir_all("output").await?;
25 tokio::fs::write("output/video_example.json", json_str).await?;
26 println!("The res is outputed to output/video_example.json");
27 Ok(())
28}pub fn qn(self, qn: Quality) -> Self
pub fn fnval(self, fnval: Fnval) -> Self
pub fn allow_4k(self) -> Self
Sourcepub async fn build(self, bili_client: &BiliClient) -> Result<VideoRequestParam>
pub async fn build(self, bili_client: &BiliClient) -> Result<VideoRequestParam>
Examples found in repository?
examples/show_video_info_raw.rs (line 18)
10async fn main() -> Result<(), Box<dyn Error>> {
11 let account = login::get_account().await?;
12 let bili_client = BiliClient::new(&account)?;
13 let bvid = extract_bv_id(
14 "https://www.bilibili.com/video/BV17W411e7VL/?spm_id_from=333.337.search-card.all.click&vd_source=8bd37d9aaf81178ae3e80214a1c8e367",
15 )?;
16 let vrp = VideoRequestParamBuilder::new(&bvid, &bili_client)
17 .await?
18 .build(&bili_client)
19 .await?;
20 let url = format!("{}?{}", VIDEO_DOWNLOAD_URL, vrp.to_query_string());
21 let resp: Value = bili_client.get(&url).send().await?.json().await?;
22
23 let json_str = serde_json::to_string_pretty(&resp)?;
24 tokio::fs::create_dir_all("output").await?;
25 tokio::fs::write("output/video_example.json", json_str).await?;
26 println!("The res is outputed to output/video_example.json");
27 Ok(())
28}Trait Implementations§
Auto Trait Implementations§
impl Freeze for VideoRequestParamBuilder
impl RefUnwindSafe for VideoRequestParamBuilder
impl Send for VideoRequestParamBuilder
impl Sync for VideoRequestParamBuilder
impl Unpin for VideoRequestParamBuilder
impl UnsafeUnpin for VideoRequestParamBuilder
impl UnwindSafe for VideoRequestParamBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more