Skip to main content

ncm_api_rs/api/
mlog_music_rcmd.rs

1use super::Query;
2use crate::error::Result;
3/// 歌曲相关视频
4/// 对应 Node.js module/mlog_music_rcmd.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 歌曲相关视频
10    /// 对应 /mlog/music/rcmd
11    pub async fn mlog_music_rcmd(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({
13            "id": query.get_or("mvid", "0").parse::<i64>().unwrap_or(0),
14            "type": 2,
15            "rcmdType": 20,
16            "limit": query.get_or("limit", "10").parse::<i64>().unwrap_or(10),
17            "extInfo": serde_json::to_string(&json!({
18                "songId": query.get_or("songid", "")
19            })).unwrap_or_default()
20        });
21        self.request(
22            "/api/mlog/rcmd/feed/list",
23            data,
24            query.to_option(CryptoType::default()),
25        )
26        .await
27    }
28}