Skip to main content

VideoClient

Struct VideoClient 

Source
pub struct VideoClient<'a> { /* private fields */ }
Expand description

Video domain API client.

Implementations§

Source§

impl<'a> VideoClient<'a>

Source

pub async fn like(&self, params: VideoLikeParams) -> BpiResult<CoinData>

Likes or unlikes a video and returns the canonical payload result.

Source

pub async fn coin(&self, params: VideoCoinParams) -> BpiResult<CoinData>

Gives coins to a video and returns the canonical payload result.

Source

pub async fn favorite( &self, params: VideoFavoriteParams, ) -> BpiResult<FavoriteData>

Favorites a video to, or removes it from, favorite folders.

Source§

impl<'a> VideoClient<'a>

Source

pub async fn view(&self, params: VideoViewParams) -> BpiResult<VideoView>

Fetches web video detail by AV ID or BV ID.

Examples found in repository?
examples/module_clients.rs (line 19)
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 quickstart compiled; set BPI_RUN_EXAMPLE=1 to call live APIs");
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}
Source

pub async fn detail(&self, params: VideoDetailParams) -> BpiResult<VideoDetail>

Fetches web video detail, including tags and related videos.

Source

pub async fn page_list( &self, params: VideoPageListParams, ) -> BpiResult<Vec<VideoPage>>

Fetches the page/content IDs for a video.

Source

pub async fn desc(&self, params: VideoDescParams) -> BpiResult<String>

Fetches the plain text video description.

Source

pub async fn play_url( &self, params: VideoPlayUrlParams, ) -> BpiResult<PlayUrlResponseData>

Fetches signed web playback URLs by AV ID or BV ID plus page/content ID.

Source

pub async fn seasons_archives_list( &self, params: VideoCollectionSeasonsArchivesParams, ) -> BpiResult<GetSeasonsArchivesData>

Fetches the videos in a specific video season.

Source

pub async fn home_seasons_series( &self, params: VideoCollectionHomeSeasonsSeriesParams, ) -> BpiResult<GetSeasonsSeriesData>

Fetches a user’s home season and series lists.

Source

pub async fn seasons_series_list( &self, params: VideoCollectionSeasonsSeriesParams, ) -> BpiResult<GetSeasonsSeriesData>

Fetches a user’s season and series list with pagination.

Source

pub async fn series_info( &self, params: VideoCollectionSeriesInfoParams, ) -> BpiResult<GetSeriesData>

Fetches metadata for a specific video series.

Source

pub async fn series_archives( &self, params: VideoCollectionSeriesArchivesParams, ) -> BpiResult<GetSeriesArchivesData>

Fetches videos in a specific video series.

Source

pub async fn online_total( &self, params: VideoOnlineTotalParams, ) -> BpiResult<OnlineTotalResponseData>

Fetches the online viewer counters for a video page.

Source

pub async fn player_info_v2( &self, params: VideoPlayerInfoParams, ) -> BpiResult<PlayerInfoResponseData>

Fetches web player metadata for a video page.

Source

pub async fn related_videos( &self, params: VideoRelatedParams, ) -> BpiResult<Vec<RelatedVideo>>

Fetches videos related to a video.

Source

pub async fn homepage_recommendations( &self, params: VideoHomepageRecommendationsParams, ) -> BpiResult<RcmdFeedResponseData>

Fetches homepage video recommendations.

Source

pub async fn ai_summary( &self, params: VideoAiSummaryParams, ) -> BpiResult<AiSummaryResponseData>

Fetches the AI summary for a video.

Source

pub async fn tags(&self, params: VideoTagsParams) -> BpiResult<Vec<VideoTag>>

Fetches tags attached to a video.

Source

pub async fn interactive_video_info( &self, params: InteractiveVideoInfoParams, ) -> BpiResult<InteractiveVideoInfoResponseData>

Fetches metadata for an interactive video node.

Source§

impl<'a> VideoClient<'a>

Source

pub async fn create_collection_series( &self, params: CollectionCreateAndAddArchivesParams, ) -> BpiResult<CreateSeriesResponseData>

Creates a video series and optionally adds archives to it.

Source

pub async fn delete_collection_series( &self, params: CollectionDeleteSeriesParams, ) -> BpiResult<Option<Value>>

Deletes a video series.

Source

pub async fn delete_collection_archives( &self, params: CollectionArchivesMutationParams, ) -> BpiResult<Option<Value>>

Deletes archives from a video series.

Source

pub async fn add_collection_archives( &self, params: CollectionArchivesMutationParams, ) -> BpiResult<Option<Value>>

Adds archives to a video series.

Source

pub async fn update_collection_series( &self, params: CollectionUpdateSeriesParams, ) -> BpiResult<Option<Value>>

Updates a video series.

Source§

impl<'a> VideoClient<'a>

Source

pub async fn report_watch_progress( &self, params: VideoWatchProgressParams, ) -> BpiResult<Option<Value>>

Reports video watch progress and returns the canonical payload result.

Trait Implementations§

Source§

impl<'a> Clone for VideoClient<'a>

Source§

fn clone(&self) -> VideoClient<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for VideoClient<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for VideoClient<'a>

§

impl<'a> !UnwindSafe for VideoClient<'a>

§

impl<'a> Freeze for VideoClient<'a>

§

impl<'a> Send for VideoClient<'a>

§

impl<'a> Sync for VideoClient<'a>

§

impl<'a> Unpin for VideoClient<'a>

§

impl<'a> UnsafeUnpin for VideoClient<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more