Skip to main content

ncm_api_rs/api/
top_song.rs

1use super::Query;
2use crate::error::Result;
3/// 新歌速递
4/// 对应 Node.js module/top_song.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 新歌速递
10    /// 对应 /top/song
11    pub async fn top_song(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({
13            "areaId": query.get_or("type", "0").parse::<i64>().unwrap_or(0),
14            "total": true
15        });
16        self.request(
17            "/api/v1/discovery/new/songs",
18            data,
19            query.to_option(CryptoType::Weapi),
20        )
21        .await
22    }
23}