### Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/user/space/struct.BangumiFollowItem.html?search= Examples of how to construct search queries for BangumiFollowItem. ```APIDOC ## Search BangumiFollowItem ### Description Provides examples of search queries that can be used to find BangumiFollowItem. ### Example Searches * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Example Search Queries Source: https://docs.rs/bpi-rs/latest/bpi_rs/article/card/enum.CardItem.html?search= Demonstrates example search queries for various types and patterns. ```text * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Example Search: u32 to bool Source: https://docs.rs/bpi-rs/latest/bpi_rs/dynamic/detail/struct.User.html?search= Demonstrates a search example for converting `u32` to `bool`. ```text * u32 -> bool ``` -------------------------------- ### InteractiveVideoPreload Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/interact_video/struct.InteractiveVideoPreload.html?search= Examples of how to search for interactive video preloads. ```APIDOC ## Search InteractiveVideoPreload ### Description Provides functionality to search for interactive video preloads based on various criteria. ### Method GET ### Endpoint `/bpi_rs/video/interact_video/search` ### Query Parameters - **query** (string) - Required - The search query string. - **limit** (integer) - Optional - The maximum number of results to return. - **offset** (integer) - Optional - The number of results to skip. ### Response #### Success Response (200) - **results** (array) - A list of matching interactive video preloads. - **id** (string) - The unique identifier of the preload. - **title** (string) - The title of the interactive video. - **thumbnail_url** (string) - The URL of the thumbnail image. #### Response Example ```json { "results": [ { "id": "video_123", "title": "Introduction to Interactive Videos", "thumbnail_url": "https://example.com/thumbnails/video_123.jpg" } ] } ``` ``` -------------------------------- ### SupportFormat Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/videostream_url/struct.SupportFormat.html?search= Examples of how to search for supported formats. ```APIDOC ## Example Searches ### Search for a specific type ``` std::vec ``` ### Search for type conversions ``` u32 -> bool ``` ### Search for generic type conversions ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### Test Get Live Stream Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/live_stream.rs.html Example test case for fetching a live stream URL using the BpiClient. ```rust #[tokio::test] async fn test_get_live_stream() { let bpi = BpiClient::new(); let resp = bpi.live_stream(14073662, Some("web"), None, Some(10000)).await.unwrap(); tracing::info!("{:?}", resp); } ``` -------------------------------- ### Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/manga/point_shop/struct.UserPointData.html?search= Examples of how to search for UserPointData. These demonstrate different query patterns. ```APIDOC ## Search UserPointData ### Description Provides examples of how to search for user point data. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Example Search Queries Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/video/collection/action.rs.html?search=u32+-%3E+bool Provides example search queries for common Rust programming concepts and type transformations. ```text std::vec u32 -> bool Option, (T -> U) -> Option ``` -------------------------------- ### Start Live Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/manage.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Starts a live stream. This is intended for use with the PC Bilibili Live Studio. ```APIDOC ## POST /room/v1/Room/startLive ### Description Starts a live stream. This operation is primarily intended for use with the PC Bilibili Live Studio. ### Method POST ### Endpoint https://api.live.bilibili.com/room/v1/Room/startLive ### Parameters #### Path Parameters - **room_id** (uint64) - Required - The ID of the room to start. - **area_v2** (uint64) - Required - The v2 area ID for the live stream. - **platform** (string) - Required - The platform from which the stream is starting (e.g., "pc"). #### Request Body - **csrf** (string) - Required - CSRF token for authentication. - **csrf_token** (string) - Required - CSRF token for authentication. ### Response #### Success Response (200) - **change** (uint8) - Description of the change. - **status** (string) - The status of the live stream. - **rtmp** (object) - RTMP streaming information. - **addr** (string) - The RTMP server address. - **code** (string) - The RTMP stream key. - **live_key** (string) - The live stream key. - **sub_session_key** (string) - The sub-session key. - **need_face_auth** (boolean) - Indicates if face authentication is required. - **room_type** (Value) - Other unspecified fields. - **protocols** (Value) - Other unspecified fields. - **notice** (Value) - Other unspecified fields. - **qr** (Value) - Other unspecified fields. - **service_source** (string) - The source of the service. - **rtmp_backup** (Value) - Other unspecified fields. - **up_stream_extra** (Value) - Other unspecified fields. ``` -------------------------------- ### Example Search: std::vec Source: https://docs.rs/bpi-rs/latest/bpi_rs/article/info/struct.ArticleInfoData.html?search= Demonstrates an example search query for `std::vec`. ```text std::vec ``` -------------------------------- ### Example Search: u32 -> bool Source: https://docs.rs/bpi-rs/latest/bpi_rs/article/info/struct.ArticleInfoData.html?search= Demonstrates an example search query for a type conversion from `u32` to `bool`. ```text u32 -> bool ``` -------------------------------- ### AudioHotMenu Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/audio/music_list/struct.AudioHotMenu.html?search= Provides examples of search queries that can be used with AudioHotMenu. ```APIDOC ## Search Examples ### Example 1: Searching for a specific module ``` std::vec ``` ### Example 2: Searching for type conversions ``` u32 -> bool ``` ### Example 3: Searching for generic type transformations ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### InteractiveVideoEdges Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/interact_video/struct.InteractiveVideoEdges.html?search= Examples of how to construct search queries for InteractiveVideoEdges. ```APIDOC ## Search Examples Example searches: * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Example Searches Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/misc/sign/appkey.rs.html?search= Illustrative examples of search queries. These demonstrate common patterns for searching within the library. ```rust * std::vec ``` ```rust * u32 -> bool ``` ```rust * Option, (T -> U) -> Option ``` -------------------------------- ### Start Live Stream Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/manage.rs.html?search=u32+-%3E+bool Starts a live stream for a given room. This is currently supported for Bilibili Live Studio (直播姬). ```APIDOC ## Start Live Stream ### Description Starts a live stream for a given room. This is currently supported for Bilibili Live Studio (直播姬). Requires authentication. ### Method POST ### Endpoint `https://api.live.bilibili.com/room/v1/Room/startLive` ### Parameters #### Path Parameters - `room_id` (uint64) - Required - The ID of the room to start streaming in. - `area_v2` (uint64) - Required - The ID of the live broadcast area. - `platform` (string) - Required - The platform, e.g., "pc". #### Query Parameters - `csrf` (string) - Required - CSRF token - `csrf_token` (string) - Required - CSRF token ### Response #### Success Response (200) - `change` (uint8) - Indicates if a change occurred. - `status` (string) - The status of the live stream. - `rtmp` (object) - RTMP streaming information. - `addr` (string) - RTMP server address. - `code` (string) - RTMP stream key. - `live_key` (string) - The live stream key. - `sub_session_key` (string) - The session key for the live stream. - `need_face_auth` (boolean) - Whether face authentication is required. - `room_type` (any) - Type of the room. - `protocols` (any) - Supported protocols. - `notice` (any) - Notice information. - `qr` (any) - QR code information. - `service_source` (string) - The source of the service. - `rtmp_backup` (any) - Backup RTMP information. - `up_stream_extra` (any) - Extra upstream information. ``` -------------------------------- ### Example Searches Source: https://docs.rs/bpi-rs/latest/bpi_rs/live/manage/struct.UpdateRoomData.html?search= Provides examples of common search patterns. ```text * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Example Searches Source: https://docs.rs/bpi-rs/latest/bpi_rs/dynamic/detail/struct.DynamicReactionItem.html?search= These examples demonstrate how to search for dynamic reaction items. They cover basic item searches, type-to-type conversions, and more complex generic type manipulations. ```APIDOC ## Example Searches ### Description Demonstrates various search patterns for dynamic reaction items. ### Usage These are illustrative examples of search queries. ### Examples * `std::vec` * `u32 -> bool` * `Option, (T -> U) -> Option` ``` -------------------------------- ### Example Search: Option, (T -> U) -> Option Source: https://docs.rs/bpi-rs/latest/bpi_rs/article/info/struct.ArticleInfoData.html?search= Demonstrates an example search query for a generic type transformation involving `Option` and function composition. ```text Option, (T -> U) -> Option ``` -------------------------------- ### InteractiveVideoHiddenVar Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/interact_video/struct.InteractiveVideoHiddenVar.html?search= Examples of how to perform searches related to InteractiveVideoHiddenVar. ```APIDOC ## Search Examples ### Example 1: Searching for a specific type ``` std::vec ``` ### Example 2: Searching for type conversions ``` u32 -> bool ``` ### Example 3: Searching for generic type conversions ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### PromptData Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/audio/action/struct.PromptData.html?search= Examples of how to search for PromptData, illustrating different query patterns. ```APIDOC ## Search PromptData ### Description Provides examples of search queries for PromptData. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Login Log Entry Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/login/login_notice/struct.LoginLogEntry.html?search= Examples of how to search login log entries. ```APIDOC ## Search Login Log Entries ### Description Provides functionality to search through login log entries based on various criteria. ### Method POST ### Endpoint /bpi_rs/login/login_notice/search ### Request Body - **query** (string) - Required - The search query string. - **limit** (integer) - Optional - The maximum number of results to return. - **offset** (integer) - Optional - The number of results to skip. ### Request Example ```json { "query": "username:john.doe", "limit": 10, "offset": 0 } ``` ### Response #### Success Response (200) - **entries** (array) - A list of matching login log entries. - **timestamp** (string) - The time the log entry occurred. - **userId** (string) - The ID of the user associated with the log entry. - **ipAddress** (string) - The IP address from which the login occurred. - **status** (string) - The status of the login attempt (e.g., "success", "failed"). #### Response Example ```json { "entries": [ { "timestamp": "2023-10-27T10:00:00Z", "userId": "user123", "ipAddress": "192.168.1.1", "status": "success" } ] } ``` ``` -------------------------------- ### Content Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/comment/types/struct.Content.html?search= Examples demonstrating how to search for specific types and conversions related to the Content type. ```APIDOC ## Example Searches ### Searching for a specific type: ``` std::vec ``` ### Searching for a type conversion (u32 to bool): ``` u32 -> bool ``` ### Searching for a more complex type transformation (Option, (T -> U) -> Option): ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### Example Searches for RepostItem Source: https://docs.rs/bpi-rs/latest/bpi_rs/dynamic/basic_info/struct.RepostItem.html?search= Illustrative examples of how to search for repost items, demonstrating various query patterns. ```APIDOC ## Example Searches ### Search for `std::vec` ```rust // Example search for std::vec ``` ### Search for `u32 -> bool` ```rust // Example search for u32 -> bool ``` ### Search for `Option, (T -> U) -> Option` ```rust // Example search for Option, (T -> U) -> Option ``` ``` -------------------------------- ### Example Searches Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/info/view/struct.Stat.html?search= Provides examples of search queries that can be used to find information within the documentation. ```APIDOC ## Example searches: * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/web_widget/header/struct.SplitLayer.html?search= Examples of how to search within SplitLayer. These demonstrate common patterns for searching types, type conversions, and generic types. ```APIDOC ## Search Examples ### Description Demonstrates common search patterns for SplitLayer. ### Example Searches * `std::vec` * `u32 -> bool` * `Option, (T -> U) -> Option` ``` -------------------------------- ### DanmakuXml Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/danmaku/danmaku_xml/struct.DanmakuXml.html?search= Provides example searches for DanmakuXml, demonstrating how to find specific types, conversions, and generic patterns. ```APIDOC ## Example Searches This section provides examples of how to perform searches within the DanmakuXml system. ### Search Syntax Examples - **Basic Type Search:** `std::vec` - **Conversion Search:** `u32 -> bool` - **Generic Conversion Search:** `Option, (T -> U) -> Option` ``` -------------------------------- ### BpiClient Initialization and Usage Example Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Demonstrates how to create a new BpiClient instance, set account credentials, and make a request to the bangumi_info endpoint. ```APIDOC ## BpiClient::new() ### Description Creates a new, globally accessible instance of `BpiClient`. It initializes the HTTP client with specific configurations like timeouts, compression support, and a cookie jar. In test or debug modes, it attempts to load test account credentials. ### Returns - `&'static Self`: A static reference to the singleton `BpiClient` instance. ## BpiClient::set_account(account: Account) ### Description Sets the account information for the `BpiClient`. If the provided `Account` is complete, it loads the associated cookies and enables authenticated requests. Otherwise, it operates in guest mode. ### Parameters - **account** (`Account`): An `Account` struct containing user credentials. ## BpiClient::bangumi_info(id: u32) ### Description Fetches information about a specific bangumi using its ID. This method requires the client to be authenticated with valid account information. ### Parameters #### Path Parameters - **id** (`u32`): The unique identifier of the bangumi. ### Request Example ```rust use bpi_rs::{ Account, BpiClient }; #[tokio::main] async fn main() { let bpi = BpiClient::new(); bpi.set_account(Account { dede_user_id: "".to_string(), dede_user_id_ckmd5: "".to_string(), sessdata: "".to_string(), bili_jct: "".to_string(), buvid3: "".to_string(), }); let result = bpi.bangumi_info(28220978).await; match result { Ok(result) => { tracing::info!("{:#?}", result.data); } Err(e) => { tracing::error!("{:#?}", e); } } } ``` ### Response #### Success Response - **data** (`serde_json::Value`): The bangumi information payload. #### Response Example ```json { "data": { "// Bangumi info details //" } } ``` ``` -------------------------------- ### Test Batch Get Favorite Resource Information Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/fav/info.rs.html?search= Example test for fetching favorite resource information. It calls `fav_resource_infos` with a sample resource string and verifies the result. ```rust #[tokio::test] async fn test_get_fav_resource_infos() { let bpi = BpiClient::new(); let resources = "115087859779103:2"; let resp = bpi.fav_resource_infos(resources).await; info!("{:?}", resp); assert!(resp.is_ok()); let resp_data = resp.unwrap(); info!("code: {}", resp_data.code); if let Some(data) = resp_data.data { info!("retrieved {} resources", data.len()); info!("first resource info: {:?}", data.first()); } } ``` -------------------------------- ### Create Client from Configuration Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search= Initializes a new BpiClient from provided account configuration. Sets the account if all required fields are present. ```rust pub fn from_config(config: &Account) -> &Self { let bpi = Self::new(); if !config.dede_user_id.is_empty() && !config.sessdata.is_empty() && !config.bili_jct.is_empty() && !config.buvid3.is_empty() { let account = Account::new( config.dede_user_id.clone(), config.dede_user_id_ckmd5.clone(), config.sessdata.clone(), config.bili_jct.clone(), config.buvid3.clone() ); bpi.set_account(account); } bpi } ``` -------------------------------- ### Test Get Danmaku Snapshot Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/danmaku/snapshot.rs.html?search= An example test function demonstrating how to use the `danmaku_snapshot` method with a sample BVID. It initializes a `BpiClient`, calls the method, and logs the retrieved data. ```rust use super::*; #[tokio::test] async fn test_get_danmaku_snapshot() -> Result<(), Box> { let bpi = BpiClient::new(); let result = bpi.danmaku_snapshot("BV1fK4y1t741").await?; let data = result.into_data()?; tracing::info!("{:#?}", data); Ok(()) } ``` -------------------------------- ### Initialize BpiClient and Set Account Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=u32+-%3E+bool Demonstrates how to create a new BpiClient instance and set user account details, including an example of making an API call. It also shows how to set account information from a cookie string. ```rust use bpi_rs::{ Account, BpiClient }; #[tokio::main] async fn main() { let bpi = BpiClient::new(); bpi.set_account(Account { dede_user_id: "".to_string(), dede_user_id_ckmd5: "".to_string(), sessdata: "".to_string(), bili_jct: "".to_string(), buvid3: "".to_string(), }); // bpi.set_account_from_cookie_str("dede_user_id=123;bili_jct=456..."); let result = bpi.bangumi_info(28220978).await; match result { Ok(result) => { tracing::info!("{:#?}", result.data); } Err(e) => { tracing::error!("{:#?}", e); } } } ``` -------------------------------- ### Rust DeserializeOwned Example Searches Source: https://docs.rs/bpi-rs/latest/bpi_rs/comment/types/struct.UpAction.html?search= Provides example search queries for `DeserializeOwned`, demonstrating common patterns like searching for specific types, type conversions, and generic type transformations. ```text Example searches: * std::vec * u32 -> bool * Option, (T -> U) -> Option ``` -------------------------------- ### Example Searches for Bangumi Badge Info Source: https://docs.rs/bpi-rs/latest/bpi_rs/bangumi/info/struct.BangumiBadgeInfo.html?search= These are example search queries that can be used to find Bangumi badge information. They demonstrate different patterns for searching, including specific types and type transformations. ```APIDOC ## Example Searches ### Search 1: Specific Type ``` std::vec ``` ### Search 2: Type Transformation ``` u32 -> bool ``` ### Search 3: Generic Type with Transformation ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### Test Get User Created Favorite Folders Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/fav/info.rs.html?search= Example test case for fetching created favorite folders. It initializes the BPI client, calls the `fav_created_list` function, and asserts the response. ```rust #[tokio::test] async fn test_get_fav_created_list() { let bpi = BpiClient::new(); let up_mid = 4279370; let resp = bpi.fav_created_list(up_mid, None, None).await; info!("{:?}", resp); assert!(resp.is_ok()); let resp_data = resp.unwrap(); info!("code: {}", resp_data.code); if let Some(data) = resp_data.data { info!("created folders count: {}", data.count); info!("first folder info: {:?}", data.list.first()); } } ``` -------------------------------- ### Test Get Recharge List with Dates - Rust Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/electric/charge_list.rs.html?search= Tests the `electric_recharge_list` function with date filters. It calculates a start and end date and asserts the response is OK, logging the total count within the date range. ```rust #[tokio::test] async fn test_get_recharge_list_with_dates() { let bpi = BpiClient::new(); let now = Utc::now().date_naive(); let start_date = now - Duration::days(30); let end_date = now; let resp = bpi.electric_recharge_list(1, 10, Some(start_date), Some(end_date)).await; info!("响应: {:?}", resp); assert!(resp.is_ok()); if let Ok(response) = resp { info!("在日期范围内获取到的总记录数: {}", response.data.unwrap().page.total_count); } ``` -------------------------------- ### ClockInInfoData Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/manga/clockin/struct.ClockInInfoData.html?search= Examples of how to search for ClockInInfoData. These examples demonstrate different query patterns. ```APIDOC ## Search Examples ### Example 1: Searching for a specific type ``` std::vec ``` ### Example 2: Searching for a type conversion ``` u32 -> bool ``` ### Example 3: Searching for generic type conversions ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### Fetch Live Follow-Up Web List Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/follow_up_live.rs.html Demonstrates fetching a web-specific list of live follow-ups. Requires the BpiClient to be initialized. ```rust use super::*; #[tokio::test] async fn test_get_follow_up_live_web_list() { let bpi = BpiClient::new(); let resp = bpi.live_follow_up_web_list(Some(false)).await.unwrap(); tracing::info!("{:?}", resp); } ``` -------------------------------- ### BangumiSection Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/bangumi/info/struct.BangumiSection.html?search= Examples of how to perform searches within BangumiSection. These examples demonstrate common search patterns. ```APIDOC ## Search Examples ### Example 1: Searching for a specific type ``` std::vec ``` ### Example 2: Searching for type conversions ``` u32 -> bool ``` ### Example 3: Searching for generic type transformations ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### BpiClient Initialization and Bangumi Info Fetch Source: https://docs.rs/bpi-rs/latest/bpi_rs/client/struct.BpiClient.html Demonstrates how to initialize BpiClient, set account information, and fetch bangumi (anime) information. Includes error handling for the API call. ```rust use bpi_rs::{ Account, BpiClient }; #[tokio::main] async fn main() { let bpi = BpiClient::new(); bpi.set_account(Account { dede_user_id: "".to_string(), dede_user_id_ckmd5: "".to_string(), sessdata: "".to_string(), bili_jct: "".to_string(), buvid3: "".to_string(), }); // bpi.set_account_from_cookie_str("dede_user_id=123;bili_jct=456..."); let result = bpi.bangumi_info(28220978).await; match result { Ok(result) => { tracing::info!(?result.data); } Err(e) => { tracing::error!(?e); } } } ``` -------------------------------- ### HistoryListItem_search Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/historytoview/history/struct.HistoryListItem.html?search= Examples of how to perform searches within the HistoryListItem_search functionality. These examples demonstrate different query patterns. ```APIDOC ## HistoryListItem_search Search ### Description Provides examples of search queries for HistoryListItem_search. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Fetch Live Follow-Up List Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/follow_up_live.rs.html Demonstrates fetching a list of live follow-ups with pagination and filtering parameters. Requires the BpiClient to be initialized. ```rust use super::*; #[tokio::test] async fn test_get_follow_up_live_list() { let bpi = BpiClient::new(); let resp = bpi.live_follow_up_list(Some(1), Some(2), Some(1), Some(true)).await.unwrap(); tracing::info!("{:?}", resp); } ``` -------------------------------- ### Interactive Video Dimension Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/interact_video/struct.InteractiveVideoDimension.html?search= Examples of how to search for interactive video dimensions. These examples demonstrate different query patterns. ```APIDOC ## Search Interactive Video Dimensions ### Description This section provides examples of search queries for interactive video dimensions. ### Example Queries - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Create BpiClient from Configuration Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Initializes a new BpiClient and optionally sets account details from a provided configuration. Only sets the account if all required fields in the config are non-empty. ```rust let bpi = Self::new(); if !config.dede_user_id.is_empty() && !config.sessdata.is_empty() && !config.bili_jct.is_empty() && !config.buvid3.is_empty() { let account = Account::new( config.dede_user_id.clone(), config.dede_user_id_ckmd5.clone(), config.sessdata.clone(), config.bili_jct.clone(), config.buvid3.clone() ); bpi.set_account(account); } bpi ``` -------------------------------- ### HTTP GET Request Wrapper Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search= Creates a GET request builder with a default user agent. Use this for making GET requests to Bilibili API endpoints. ```rust pub fn get(&self, url: &str) -> RequestBuilder { self.client.get(url).with_user_agent() } ``` -------------------------------- ### Create GET Request Builder Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a GET request builder for a given URL, automatically including the user agent. Use this for making GET requests. ```rust self.client.get(url).with_user_agent() ``` -------------------------------- ### Example Searches Source: https://docs.rs/bpi-rs/latest/bpi_rs/web_widget/banner/struct.RegionBanner.html?search= Demonstrates common search patterns for type conversions and generic types. ```rust * std::vec ``` ```rust * u32 -> bool ``` ```rust * Option, (T -> U) -> Option ``` -------------------------------- ### ArticleInfoData_search Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/article/info/struct.ArticleInfoData.html?search= Examples of how to perform searches on ArticleInfoData. ```APIDOC ## ArticleInfoData_search Search ### Description Provides examples of search queries for ArticleInfoData. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Basic Appkey Example Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/misc/sign/appkey.rs.html?search= A simple placeholder for appkey functionality. This snippet is a basic representation and may require further implementation. ```rust 1 ``` -------------------------------- ### get Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=u32+-%3E+bool Creates a GET request builder with a default user agent. ```APIDOC ## get ### Description Creates a `RequestBuilder` for a GET request, automatically including a user agent. ### Method Signature `pub fn get(&self, url: &str) -> RequestBuilder` ### Parameters - `url` (`&str`): The URL to send the GET request to. ### Returns - `RequestBuilder`: A `RequestBuilder` instance configured for the GET request. ``` -------------------------------- ### get Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search= Creates a GET request builder with the User-Agent header pre-configured. ```APIDOC ## get ### Description Creates a `RequestBuilder` for a GET request, automatically including the User-Agent header. ### Method `pub fn get(&self, url: &str) -> RequestBuilder` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (`&str`) - The URL to send the GET request to. ### Returns `RequestBuilder` - A `RequestBuilder` instance configured for the GET request. ``` -------------------------------- ### Basic Search Example Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/message/settings.rs.html?search= Demonstrates a basic search pattern for std::vec. ```rust 1 ``` -------------------------------- ### Test Homepage Video Recommendations Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/video/recommend.rs.html Tests the `video_homepage_recommendations` function with sample parameters and asserts that the returned item list is not empty and within the expected size limits. ```rust #[tokio::test] async fn test_video_homepage_recommendations() -> Result<(), BpiError> { let bpi = BpiClient::new(); let resp = bpi.video_homepage_recommendations(Some(12), Some(1), Some(1)).await?; let data = resp.into_data()?; info!("首页推荐列表: {:?}", data); assert!(!data.item.is_empty()); assert!(data.item.len() <= 30); Ok(()) } ``` -------------------------------- ### Account::new Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/auth.rs.html?search=std%3A%3Avec Constructor for the Account struct, initializing it with provided Bilibili account credentials. ```APIDOC ## Account::new ### Description Creates a new `Account` instance with the provided credentials. ### Parameters - **dede_user_id** (String) - The user ID for Bilibili. - **dede_user_id_ckmd5** (String) - MD5 hash of the user ID. - **sessdata** (String) - Session data for authentication. - **bili_jct** (String) - CSRF token for Bilibili. - **buvid3** (String) - Buvid identifier. ### Returns - `Self` - A new `Account` instance. ``` -------------------------------- ### get Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Performs a GET request to the specified URL, automatically including the user agent. ```APIDOC ## get ### Description Performs a GET request to the specified URL, automatically including the user agent. ### Method `pub fn get(&self, url: &str) -> RequestBuilder` ### Parameters - `url` (`&str`): The URL to send the GET request to. ### Returns - `RequestBuilder`: A `RequestBuilder` object configured for the GET request with the user agent. ``` -------------------------------- ### Account::new Source: https://docs.rs/bpi-rs/latest/bpi_rs/auth/struct.Account.html?search=std%3A%3Avec Constructor for creating a new Account instance with provided login credentials. ```APIDOC ## impl Account ### pub fn new( dede_user_id: String, dede_user_id_ckmd5: String, sessdata: String, bili_jct: String, buvid3: String, ) -> Self Creates a new Account instance. ``` -------------------------------- ### get Source: https://docs.rs/bpi-rs/latest/bpi_rs/client/struct.BpiClient.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Wrapper for reqwest's GET request, includes a default user agent. ```APIDOC ## get ### Description Wrapper for reqwest's GET request, includes a default user agent. ### Method `fn` ### Parameters #### Path Parameters - **url** (&str) - Required - The URL to send the GET request to. ``` -------------------------------- ### from_config Source: https://docs.rs/bpi-rs/latest/bpi_rs/client/struct.BpiClient.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a BpiClient instance from configuration. ```APIDOC ## from_config ### Description Creates a BpiClient instance from configuration. ### Method `fn` ### Parameters #### Path Parameters - **config** (&Account) - Required - Account configuration ``` -------------------------------- ### New UserCard Creation Source: https://docs.rs/bpi-rs/latest/bpi_rs/user/info/struct.UserCard.html Example of creating a new UserCard instance with initial profile, account, and metadata. ```rust let user_card = UserCard { profile: Profile { id: "user-123".to_string(), name: "Alice Smith".to_string(), email: "alice.smith@example.com".to_string(), avatar_url: Some("http://example.com/avatar.jpg".to_string()), }, account: Account { user_id: "user-123".to_string(), status: AccountStatus::Active, created_at: Utc::now(), updated_at: Utc::now(), }, metadata: Metadata { last_login: None, preferences: HashMap::new(), }, }; ``` -------------------------------- ### Start Bilibili Live Stream Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/live/manage.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Initiates a live stream for a given room ID and partition. Currently supports PC live streaming clients. ```rust /// 开始直播 (目前仅支持直播姬开播) /// /// # 参数 /// * `room_id` - 直播间 ID /// * `area_v2` - 直播分区 ID /// * `platform` - 直播平台,如 "pc" #[allow(dead_code)] async fn live_start( &self, room_id: u64, area_v2: u64, platform: &str, ) -> Result, BpiError> { let csrf = self.csrf()?; let form = Form::new() .text("room_id", room_id.to_string()) .text("area_v2", area_v2.to_string()) .text("platform", platform.to_string()) .text("csrf", csrf.clone()) .text("csrf_token", csrf); self.post("https://api.live.bilibili.com/room/v1/Room/startLive") .multipart(form) .send_bpi("开始直播") .await } ``` -------------------------------- ### Section Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/user/space/struct.Section.html?search= Examples of how to perform searches for sections. These demonstrate different search patterns. ```APIDOC ## Search Examples ### Example 1: Searching for a specific module ``` std::vec ``` ### Example 2: Searching for a type conversion ``` u32 -> bool ``` ### Example 3: Searching for a generic function with type constraints ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### CommentType Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/comment/action/enum.CommentType.html?search= Examples of how to search for comment types using various query patterns. ```APIDOC ## CommentType Search ### Description This section provides examples of how to search for comment types. ### Example Searches - `std::vec` - `u32 -> bool` - `Option, (T -> U) -> Option` ``` -------------------------------- ### Test Fetch Video Info Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/video/info/view.rs.html?search=std%3A%3Avec Example of how to test the `video_info` function by creating a BpiClient and calling the function with a sample AID. ```rust #[tokio::test] async fn test_video_info() { let bpi = BpiClient::new(); let aid = Some(10001); let bvid = None; match bpi.video_info(aid, bvid).await { Ok(resp) => { ``` -------------------------------- ### Example: Create HashMap from Array Source: https://docs.rs/bpi-rs/latest/bpi_rs/danmaku/thumbup/type.ThumbupStatsMap.html Demonstrates creating a HashMap from an array of key-value pairs. ```rust use std::collections::HashMap; ``` -------------------------------- ### Basic Search Example Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/info/view/struct.HonorItem.html?search= Demonstrates a simple search query for 'std::vec'. ```APIDOC ## Search ### Description Performs a search for a given query. ### Query Parameters - **query** (string) - Required - The search term. ### Request Example ```http GET /search?query=std::vec ``` ### Response #### Success Response (200) - **results** (array) - A list of search results. #### Response Example ```json { "results": [ { "id": "123", "name": "Vec Example", "description": "An example of a vector." } ] } ``` ``` -------------------------------- ### from_config Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new BpiClient instance from configuration, optionally setting account details if provided. ```APIDOC ## from_config ### Description Creates a new BpiClient instance from configuration, optionally setting account details if provided. ### Method `pub fn from_config(config: &Account) -> &Self` ### Parameters - `config` (`&Account`): A reference to an `Account` struct containing configuration details. ### Returns - `&Self`: A reference to the newly created `BpiClient` instance. ``` -------------------------------- ### Account::new Source: https://docs.rs/bpi-rs/latest/bpi_rs/auth/struct.Account.html?search=u32+-%3E+bool Constructor for creating a new Account instance. ```APIDOC ## impl Account ### `fn new( dede_user_id: String, dede_user_id_ckmd5: String, sessdata: String, bili_jct: String, buvid3: String, ) -> Self` Creates a new Account instance with the provided credentials. ``` -------------------------------- ### Account::new Source: https://docs.rs/bpi-rs/latest/bpi_rs/auth/struct.Account.html?search= Constructor for creating a new Account instance. ```APIDOC ## Account::new ### Description Creates a new `Account` instance with the provided login information. ### Parameters - `dede_user_id`: String - The user ID. - `dede_user_id_ckmd5`: String - MD5 hash of the user ID. - `sessdata`: String - Session data. - `bili_jct`: String - CSRF token. - `buvid3`: String - Buvid identifier. ### Returns - `Self` - A new `Account` instance. ``` -------------------------------- ### Bangumi Series Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/bangumi/info/struct.BangumiSeries.html?search= Examples of how to search for Bangumi series. These demonstrate common search queries and patterns. ```APIDOC ## Search Bangumi Series ### Description Provides functionality to search for Bangumi series based on various criteria. ### Example Searches * `std::vec` * `u32 -> bool` * `Option, (T -> U) -> Option` ``` -------------------------------- ### from_config Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search= Creates a new BpiClient instance from configuration, optionally setting account details. ```APIDOC ## from_config ### Description Initializes a `BpiClient` from a provided `Account` configuration. If the configuration contains valid account details, they are set on the client. ### Method `pub fn from_config(config: &Account) -> &Self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **config** (`&Account`) - A reference to an `Account` struct containing configuration details. ### Returns `&Self` - A reference to the newly created `BpiClient` instance. ``` -------------------------------- ### Creating a new UserProfile Source: https://docs.rs/bpi-rs/latest/bpi_rs/dynamic/basic_info/struct.UserProfile.html Demonstrates how to create a new UserProfile instance with provided user details. ```rust let user_profile = UserProfile { user_id: UserId::new(), username: Username::new("john_doe".to_string()), email: Email::new("john.doe@example.com".to_string()), created_at: Utc::now(), }; ``` -------------------------------- ### Get Course Info by Episode ID Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/cheese/info.rs.html?search= A convenience method to get course information specifically by its episode ID. ```APIDOC ## GET /pugv/view/web/season (by ep_id) ### Description A convenience method to get course information specifically by its episode ID. ### Method GET ### Endpoint https://api.bilibili.com/pugv/view/web/season ### Parameters #### Query Parameters - **ep_id** (u64) - Required - The episode ID of the course. ### Response #### Success Response (200) - **data** (CourseInfo) - Detailed course information. #### Error Response - **BpiError::parse** - Returned if `ep_id` is not provided. ``` -------------------------------- ### Get Course Info by Season ID Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/cheese/info.rs.html?search= A convenience method to get course information specifically by its season ID. ```APIDOC ## GET /pugv/view/web/season (by season_id) ### Description A convenience method to get course information specifically by its season ID. ### Method GET ### Endpoint https://api.bilibili.com/pugv/view/web/season ### Parameters #### Query Parameters - **season_id** (u64) - Required - The season ID of the course. ### Response #### Success Response (200) - **data** (CourseInfo) - Detailed course information. #### Error Response - **BpiError::parse** - Returned if `season_id` is not provided. ``` -------------------------------- ### Search Examples for CreatedFolderItem Source: https://docs.rs/bpi-rs/latest/bpi_rs/fav/info/struct.CreatedFolderItem.html?search= Illustrates different ways to search for created folder items using various patterns. ```APIDOC ## Search Examples This section provides examples of how to search for created folder items. These examples demonstrate common search patterns. ### Example 1: Searching for a specific type ```rust // Example: Search for items of type std::vec let search_query = "std::vec"; ``` ### Example 2: Searching for type conversions ```rust // Example: Search for u32 to bool conversions let search_query = "u32 -> bool"; ``` ### Example 3: Searching for generic type transformations ```rust // Example: Search for Option, (T -> U) -> Option let search_query = "Option, (T -> U) -> Option"; ``` ``` -------------------------------- ### BpiClient::new Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/client.rs.html?search= Creates a new instance of the BpiClient. It initializes the HTTP client with specific configurations like timeouts and compression support, and sets up a cookie jar. In debug or test modes, it attempts to load test account credentials. ```APIDOC ## BpiClient::new ### Description Creates a new instance of the BpiClient. It initializes the HTTP client with specific configurations like timeouts and compression support, and sets up a cookie jar. In debug or test modes, it attempts to load test account credentials. ### Returns - &'static Self - A static reference to the BpiClient instance. ``` -------------------------------- ### Get Entry for In-place Manipulation Source: https://docs.rs/bpi-rs/latest/bpi_rs/creativecenter/statistics_data/type.ViewerAreaMap.html?search= Gets the given key’s corresponding entry in the map for in-place manipulation. ```APIDOC ## pub fn entry(&mut self, key: K) -> Entry<'_, K, V, A> ### Description Gets the given key’s corresponding entry in the map for in-place manipulation. ### Examples ```rust use std::collections::HashMap; let mut letters = HashMap::new(); for ch in "a short treatise on fungi".chars() { letters.entry(ch).and_modify(|counter| *counter += 1).or_insert(1); } assert_eq!(letters[&'s'], 2); assert_eq!(letters[&'t'], 3); assert_eq!(letters[&'u'], 1); assert_eq!(letters.get(&'y'), None); ``` ``` -------------------------------- ### Logout Data Search Examples Source: https://docs.rs/bpi-rs/latest/bpi_rs/login/exit/struct.LogoutData.html?search= Examples of how to search for logout data. These demonstrate common patterns for searching within the system. ```APIDOC ## Search Examples ### Example 1: Searching for a specific type ``` std::vec ``` ### Example 2: Searching for a type conversion ``` u32 -> bool ``` ### Example 3: Searching for a generic type conversion with a closure ``` Option, (T -> U) -> Option ``` ``` -------------------------------- ### Example Searches for AI Summary Parts Source: https://docs.rs/bpi-rs/latest/bpi_rs/video/summary/struct.AiSummaryPartOutline.html?search= Demonstrates various ways to search for AI summary parts and outlines using different query patterns. ```APIDOC ## Example Searches This section provides examples of how to search for AI summary parts and outlines. ### Search Patterns - **Specific Item Search**: Search for a known item like `std::vec`. - **Type Conversion Search**: Search for type conversions, e.g., `u32 -> bool`. - **Generic Type Search**: Search for generic type manipulations, e.g., `Option, (T -> U) -> Option`. ``` -------------------------------- ### Test Video Description Query Source: https://docs.rs/bpi-rs/latest/src/bpi_rs/video/info/desc.rs.html?search= An example test case demonstrating how to use the `video_desc` method to fetch a video's description and log the result or any errors encountered. ```rust #[tokio::test] async fn test_video_desc() { let bpi = BpiClient::new(); match bpi.video_desc(Some(10001), None).await { Ok(resp) => { if resp.code == 0 { tracing::info!("稿件简介: {}", resp.data.unwrap()); } else { tracing::info!("请求失败: code={}, message={}", resp.code, resp.message); } } Err(err) => { panic!("请求出错: {}", err); } } } ```