Skip to main content

ncm_api_rs/api/
related_allvideo.rs

1use super::Query;
2use crate::error::Result;
3/// 相关视频
4/// 对应 Node.js module/related_allvideo.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 相关视频
10    /// 对应 /related/allvideo
11    pub async fn related_allvideo(&self, query: &Query) -> Result<ApiResponse> {
12        let id = query.get_or("id", "0");
13        let id_type = if id.chars().all(|c| c.is_ascii_digit()) {
14            0
15        } else {
16            1
17        };
18        let data = json!({
19            "id": id,
20            "type": id_type
21        });
22        self.request(
23            "/api/cloudvideo/v1/allvideo/rcmd",
24            data,
25            query.to_option(CryptoType::Weapi),
26        )
27        .await
28    }
29}