pub struct VideoViewParams { /* private fields */ }Expand description
/x/web-interface/view 的参数。
Implementations§
Source§impl VideoViewParams
impl VideoViewParams
Sourcepub fn from_bvid(bvid: Bvid) -> Self
pub fn from_bvid(bvid: Bvid) -> Self
使用已验证的 BV ID 创建视频详情参数。
Examples found in repository?
examples/module_clients.rs (line 11)
9async fn main() -> BpiResult<()> {
10 let client = client_from_env()?;
11 let video_params = VideoViewParams::from_bvid("BV1xx411c7mD".parse::<Bvid>()?);
12 let bangumi_params = BangumiInfoParams::new(MediaId::new(28_220_978)?);
13
14 if !run_live_example() {
15 println!("module-client 快速示例已编译;设置 BPI_RUN_EXAMPLE=1 后会发起真实网络请求");
16 return Ok(());
17 }
18
19 let video = client.video().view(video_params).await?;
20 println!("video: {}", video.title);
21
22 let bangumi = client.bangumi().info(bangumi_params).await?;
23 println!("bangumi: {}", bangumi.media.title);
24
25 if env::var_os("BPI_COOKIE").is_some() {
26 let nav = client.login().nav().await?;
27 println!("logged in: {}", nav.is_login);
28 }
29
30 Ok(())
31}More examples
examples/video_info.rs (line 26)
21async fn main() -> BpiResult<()> {
22 let bvid = video_bvid()?;
23 let client = BpiClient::new()?;
24 let video = client.video();
25
26 let view = video.view(VideoViewParams::from_bvid(bvid.clone())).await?;
27 println!(
28 "视频: {} ({}) UP={} 播放={} 点赞={}",
29 view.title, view.bvid, view.owner.name, view.stat.view, view.stat.like
30 );
31
32 let pages = video
33 .page_list(VideoPageListParams::from_bvid(bvid.clone()))
34 .await?;
35 println!("分 P 数: {}", pages.len());
36 for page in pages.iter().take(5) {
37 println!(" P{} cid={} {}", page.page, page.cid, page.part);
38 }
39
40 let desc = video.desc(VideoDescParams::from_bvid(bvid)).await?;
41 let first_line = desc.lines().next().unwrap_or("");
42 println!("简介首行: {first_line}");
43
44 Ok(())
45}Trait Implementations§
Source§impl Clone for VideoViewParams
impl Clone for VideoViewParams
Source§fn clone(&self) -> VideoViewParams
fn clone(&self) -> VideoViewParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VideoViewParams
impl Debug for VideoViewParams
impl Eq for VideoViewParams
Source§impl PartialEq for VideoViewParams
impl PartialEq for VideoViewParams
Source§fn eq(&self, other: &VideoViewParams) -> bool
fn eq(&self, other: &VideoViewParams) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for VideoViewParams
Auto Trait Implementations§
impl Freeze for VideoViewParams
impl RefUnwindSafe for VideoViewParams
impl Send for VideoViewParams
impl Sync for VideoViewParams
impl Unpin for VideoViewParams
impl UnsafeUnpin for VideoViewParams
impl UnwindSafe for VideoViewParams
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