pub struct BpiClient { /* private fields */ }Expand description
Bilibili API client.
Implementations§
Source§impl BpiClient
impl BpiClient
Sourcepub fn builder() -> BpiClientBuilder
pub fn builder() -> BpiClientBuilder
Starts configuring a client.
Sourcepub fn set_account(&self, account: Account) -> Result<(), BpiError>
pub fn set_account(&self, account: Account) -> Result<(), BpiError>
Sets account information and updates this client’s cookie state.
Sourcepub fn clear_account(&self)
pub fn clear_account(&self)
Clears account information from this client.
Sets account information from a raw Cookie header string.
Checks whether this client has login cookies.
Sourcepub fn get_account(&self) -> Option<Account>
pub fn get_account(&self) -> Option<Account>
Returns the current account information.
Sourcepub fn csrf(&self) -> Result<String, BpiError>
pub fn csrf(&self) -> Result<String, BpiError>
Gets the current CSRF token from account information.
Sourcepub fn get(&self, url: &str) -> RequestBuilder
pub fn get(&self, url: &str) -> RequestBuilder
Creates a GET request with this client’s default Bilibili headers.
Sourcepub fn post(&self, url: &str) -> RequestBuilder
pub fn post(&self, url: &str) -> RequestBuilder
Creates a POST request with this client’s default Bilibili headers.
Source§impl BpiClient
impl BpiClient
Sourcepub fn activity(&self) -> ActivityClient<'_>
pub fn activity(&self) -> ActivityClient<'_>
Creates an activity domain client.
Sourcepub fn article(&self) -> ArticleClient<'_>
pub fn article(&self) -> ArticleClient<'_>
Creates an article domain client.
Sourcepub fn audio(&self) -> AudioClient<'_>
pub fn audio(&self) -> AudioClient<'_>
Creates an audio domain client.
Sourcepub fn bangumi(&self) -> BangumiClient<'_>
pub fn bangumi(&self) -> BangumiClient<'_>
Creates a bangumi domain client.
Examples found in repository?
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}Sourcepub fn cheese(&self) -> CheeseClient<'_>
pub fn cheese(&self) -> CheeseClient<'_>
Creates a cheese course domain client.
Sourcepub fn clientinfo(&self) -> ClientInfoClient<'_>
pub fn clientinfo(&self) -> ClientInfoClient<'_>
Creates a client info domain client.
Sourcepub fn comment(&self) -> CommentClient<'_>
pub fn comment(&self) -> CommentClient<'_>
Creates a comment domain client.
Sourcepub fn creativecenter(&self) -> CreativeCenterClient<'_>
pub fn creativecenter(&self) -> CreativeCenterClient<'_>
Creates a creative center domain client.
Sourcepub fn danmaku(&self) -> DanmakuClient<'_>
pub fn danmaku(&self) -> DanmakuClient<'_>
Creates a danmaku domain client.
Sourcepub fn dynamic(&self) -> DynamicClient<'_>
pub fn dynamic(&self) -> DynamicClient<'_>
Creates a dynamic domain client.
Sourcepub fn electric(&self) -> ElectricClient<'_>
pub fn electric(&self) -> ElectricClient<'_>
Creates an electric charging domain client.
Sourcepub fn historytoview(&self) -> HistoryToViewClient<'_>
pub fn historytoview(&self) -> HistoryToViewClient<'_>
Creates a history and to-view domain client.
Sourcepub fn login(&self) -> LoginClient<'_>
pub fn login(&self) -> LoginClient<'_>
Creates a login domain client.
Examples found in repository?
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}Sourcepub fn live(&self) -> LiveClient<'_>
pub fn live(&self) -> LiveClient<'_>
Creates a live domain client.
Sourcepub fn manga(&self) -> MangaClient<'_>
pub fn manga(&self) -> MangaClient<'_>
Creates a manga domain client.
Sourcepub fn misc(&self) -> MiscClient<'_>
pub fn misc(&self) -> MiscClient<'_>
Creates a misc domain client.
Sourcepub fn message(&self) -> MessageClient<'_>
pub fn message(&self) -> MessageClient<'_>
Creates a message domain client.
Sourcepub fn note(&self) -> NoteClient<'_>
pub fn note(&self) -> NoteClient<'_>
Creates a note domain client.
Sourcepub fn opus(&self) -> OpusClient<'_>
pub fn opus(&self) -> OpusClient<'_>
Creates an opus domain client.
Sourcepub fn search(&self) -> SearchClient<'_>
pub fn search(&self) -> SearchClient<'_>
Creates a search domain client.
Sourcepub fn video(&self) -> VideoClient<'_>
pub fn video(&self) -> VideoClient<'_>
Creates a video domain client.
Examples found in repository?
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}Sourcepub fn video_ranking(&self) -> VideoRankingClient<'_>
pub fn video_ranking(&self) -> VideoRankingClient<'_>
Creates a video ranking domain client.
Sourcepub fn wallet(&self) -> WalletClient<'_>
pub fn wallet(&self) -> WalletClient<'_>
Creates a wallet domain client.
Sourcepub fn user(&self) -> UserClient<'_>
pub fn user(&self) -> UserClient<'_>
Creates a user domain client.
Sourcepub fn web_widget(&self) -> WebWidgetClient<'_>
pub fn web_widget(&self) -> WebWidgetClient<'_>
Creates a web widget domain client.
Sourcepub fn from_config(config: &Account) -> Result<Self, BpiError>
pub fn from_config(config: &Account) -> Result<Self, BpiError>
Creates a client from structured account configuration.