### Frontend API Calls with Axios Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Provides examples of how a frontend application can interact with the ncm-api-rs HTTP server using Axios. Covers searching songs, getting song details, logging in, and calling authenticated endpoints with cookies. ```javascript // 搜索歌曲 const res = await axios.get('/cloudsearch', { params: { keywords: '海阔天空' } }) // 获取歌曲详情 const res = await axios.get('/song/detail', { params: { ids: '347230' } }) // POST 方式调用 const res = await axios.post('/login/cellphone', { phone: '138xxxx8000', password: 'xxx', }) // 带 Cookie 调用需要登录的接口 const res = await axios.get('/user/playlist', { params: { uid: '32953014', cookie: 'MUSIC_U=xxx' }, }) ``` -------------------------------- ### Get Music Calendar Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md After logging in, call this interface with start and end timestamps to get the music calendar. Optional parameters 'startTime' and 'endTime'. ```Rust let query = Query::new() .param("startTime", "1606752000000") .param("endTime", "1609430399999"); let result = client.calendar(&query).await.unwrap(); ``` -------------------------------- ### Install NCM API Rust SDK HTTP Server Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Install the NCM API Rust SDK as a command-line tool with the 'server' feature enabled. This allows you to run it as a standalone HTTP server. ```bash cargo install ncm-api-rs --features server ``` -------------------------------- ### Get Recommended Videos Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches a list of recommended videos, paginated by offset. ```rust let query = Query::new().param("offset", "10"); let result = client.video_timeline_recommend(&query).await?; ``` -------------------------------- ### Get All Videos List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of all videos, paginated by offset. ```rust let query = Query::new(); let result = client.video_timeline_all(&query).await?; ``` -------------------------------- ### Get Personalized MVs Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of personalized MV recommendations. ```rust let query = Query::new(); let result = client.personalized_mv(&query).await?; ``` -------------------------------- ### Configure HTTP Server with Environment Variables Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Demonstrates how to configure the HTTP server's host, port, and CORS origin using environment variables. Examples show custom port and multiple CORS origins. ```bash # 示例:自定义端口和 CORS NCM_HOST=127.0.0.1 NCM_PORT=8080 CORS_ALLOW_ORIGIN=http://localhost:5173 cargo run --features server --bin ncm-server # 示例:允许多个源 CORS_ALLOW_ORIGIN=https://a.com,https://b.com cargo run --features server --bin ncm-server ``` -------------------------------- ### Get Yunbei Income Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to retrieve Yunbei income. Optional parameters include 'limit' for the number of items and 'offset' for the starting position. ```Rust let query = Query::new().param("limit", "1"); let result = client.yunbei_receipt(&query).await.unwrap(); ``` -------------------------------- ### Get Yearly Listening Footprint Report Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint after logging in to get your yearly listening footprint report. ```Rust let query = Query::new(); let result = client.listen_data_year_report(&query).await.unwrap(); ``` -------------------------------- ### Run NCM API Rust SDK HTTP Server (Linux/macOS) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md After downloading and extracting the server binary for Linux or macOS, execute it from the terminal to start the HTTP server. ```bash tar xzf ncm-server-*.tar.gz ./ncm-server ``` -------------------------------- ### Get Style List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of music styles along with their corresponding tag IDs. ```rust let query = Query::new(); let result = client.style_list(&query).await.unwrap(); ``` -------------------------------- ### Get Style Preference Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the user's preferred music styles. Requires user login. ```rust let query = Query::new(); let result = client.style_preference(&query).await.unwrap(); ``` -------------------------------- ### Get Song Chorus Time Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the start and end times for the chorus section of a song. Requires the song ID. ```rust let query = Query::new().param("id", "2058263032"); let result = client.song_chorus(&query).await?; ``` -------------------------------- ### Get Video Category List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of video categories. ```rust let query = Query::new(); let result = client.video_category_list(&query).await?; ``` -------------------------------- ### Basic NCM API Rust SDK Usage: Search, Detail, Lyric, URL Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Demonstrates basic client creation and usage for searching songs, retrieving song details, fetching lyrics, and getting song playback URLs without authentication. ```rust use ncm_api_rs::{create_client, Query}; #[tokio::main] async fn main() { // 创建客户端(不带 cookie) let client = create_client(None); // 搜索歌曲 let query = Query::new() .param("keywords", "晴天 周杰伦") .param("type", "1") // 1=歌曲 .param("limit", "10"); let result = client.cloudsearch(&query).await.unwrap(); println!("{}", result.body); // 获取歌曲详情 let query = Query::new().param("ids", "186016"); let detail = client.song_detail(&query).await.unwrap(); println!("{}", detail.body); // 获取歌词 let query = Query::new().param("id", "186016"); let lyric = client.lyric(&query).await.unwrap(); println!("{}", lyric.body["lrc"]["lyric"]); // 获取播放链接 let query = Query::new() .param("id", "186016") .param("level", "standard"); let url = client.song_url_v1(&query).await.unwrap(); println!("{}", url.body); } ``` -------------------------------- ### Get Video Tag List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of available video tags. ```rust let query = Query::new(); let result = client.video_group_list(&query).await?; ``` -------------------------------- ### Get Sign-in Progress Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get sign-in progress. An optional 'moduleId' parameter defaults to '1207signin-1207signin'. ```Rust let query = Query::new() .param("moduleId", "1207signin-1207signin"); let result = client.signin_progress(&query).await.unwrap(); ``` -------------------------------- ### Get Client Song Download URL (New Version) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Provides download URLs for songs, enabling free users to access Hi-Res quality for fee-free songs. Requires song ID and playback level. ```rust let query = Query::new() .param("id", "2155423468") .param("level", "hires"); let result = client.song_download_url_v1(&query).await?; ``` -------------------------------- ### Get Artists by Style Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves artists associated with a specific music style. Supports pagination. ```rust let query = Query::new().param("tagId", "1000"); let result = client.style_artist(&query).await.unwrap(); ``` -------------------------------- ### Get Subscribed Columns (Topics) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get your subscribed columns (topics). Optional parameters include 'limit' (default 50) and 'offset'. ```Rust let query = Query::new() .param("limit", "2") .param("offset", "1"); let result = client.topic_sublist(&query).await.unwrap(); ``` -------------------------------- ### Get Topic Detail Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get topic details. Requires the 'actid' parameter for the topic ID. ```Rust let query = Query::new().param("actid", "111551188"); let result = client.topic_detail(&query).await.unwrap(); ``` -------------------------------- ### Get Yunbei Recommended Song History Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get the history of recommended songs for Yunbei. Optional parameters include 'size' for the number of results and 'cursor' for pagination. ```Rust let query = Query::new().param("size", "10"); let result = client.yunbei_rcmd_song_history(&query).await.unwrap(); ``` -------------------------------- ### Get Hot Topics Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get hot topics. Optional parameters include 'limit' (default 20) and 'offset'. ```Rust let query = Query::new() .param("limit", "30") .param("offset", "30"); let result = client.hot_topic(&query).await.unwrap(); ``` -------------------------------- ### Get Style Detail Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves detailed information about a specific music style using its tag ID. ```rust let query = Query::new().param("tagId", "1000"); let result = client.style_detail(&query).await.unwrap(); ``` -------------------------------- ### Get Annual Listening Report Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md After logging in, call this interface to get the current user's annual listening report. Supports reports from 2017-2024. Requires the 'year' parameter. ```Rust let query = Query::new().param("year", "2024"); let result = client.summary_annual(&query).await.unwrap(); ``` -------------------------------- ### Get Yunbei Today's Sign-in Info Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint after logging in to get today's Yunbei sign-in information, including the number of Yunbei obtained. ```Rust let query = Query::new(); let result = client.yunbei_today(&query).await.unwrap(); ``` -------------------------------- ### Get Playlists by Style Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves playlists associated with a specific music style. Supports pagination. ```rust let query = Query::new().param("tagId", "1000"); let result = client.style_playlist(&query).await.unwrap(); ``` -------------------------------- ### signin_progress Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the sign-in progress. Allows specifying a module ID to get progress for a specific sign-in module. ```APIDOC ## signin_progress - 签到进度 ### Description Retrieves the sign-in progress. Allows specifying a module ID to get progress for a specific sign-in module. ### Method Not specified (Rust client method) ### Endpoint Not specified ### Parameters #### Query Parameters - **moduleId** (string) - Optional - The ID of the module for which to retrieve sign-in progress. Defaults to '1207signin-1207signin'. ### Request Example ```rust let query = Query::new() .param("moduleId", "1207signin-1207signin"); let result = client.signin_progress(&query).await.unwrap(); ``` ### Response Success response details are not specified. ``` -------------------------------- ### Get Video Details Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves detailed information for a specific video ID. ```rust let query = Query::new().param("id", "89ADDE33C0AAE8EC14B99F6750DB954D"); let result = client.video_detail(&query).await?; ``` -------------------------------- ### Get Radio Banner Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the banner information for radio stations. ```rust let query = Query::new(); let result = client.dj_banner(&query).await.unwrap(); ``` -------------------------------- ### Get Videos by Tag/Category Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches videos associated with a specific tag or category ID. Supports pagination via offset. ```rust let query = Query::new().param("id", "9104"); let result = client.video_group(&query).await?; ``` -------------------------------- ### Get Weekly/Monthly Listening Time Report Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your weekly or monthly listening time. The 'type' parameter must be 'week' or 'month'. Data for the current year is not supported if it has not ended. ```Rust let query = Query::new().param("type", "month"); let result = client.listen_data_realtime_report(&query).await.unwrap(); ``` -------------------------------- ### Get Albums by Style Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves albums associated with a specific music style. Supports pagination and sorting by popularity or recency. ```rust let query = Query::new().param("tagId", "1000"); let result = client.style_album(&query).await.unwrap(); ``` -------------------------------- ### Get Subscribed MV List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches a list of MVs that the user has subscribed to. ```rust let query = Query::new(); let result = client.mv_sublist(&query).await?; ``` -------------------------------- ### Get Digital Album Detail Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves detailed information for a specific digital album using its ID. ```rust let query = Query::new().param("id", "120605500"); let result = client.digital_album_detail(&query).await.unwrap(); ``` -------------------------------- ### Get Yunbei To-Do Tasks Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to retrieve the Yunbei to-do tasks. ```Rust let query = Query::new(); let result = client.yunbei_tasks_todo(&query).await.unwrap(); ``` -------------------------------- ### Get Song Wiki Summary Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches a summary of the song's encyclopedia information. Requires the song ID. ```rust let query = Query::new().param("id", "1958384591"); let result = client.song_wiki_summary(&query).await?; ``` -------------------------------- ### Get Song Lyrics Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches the lyrics for a given song ID. No login is required for this operation. ```rust let query = Query::new().param("id", "33894312"); let result = client.lyric(&query).await?; ``` -------------------------------- ### Get All Yunbei Tasks Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to retrieve all available Yunbei tasks. ```Rust let query = Query::new(); let result = client.yunbei_tasks(&query).await.unwrap(); ``` -------------------------------- ### Get Song URL (New Version) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the playback URL for a song with specified quality. Requires song ID and playback quality level. ```rust let query = Query::new() .param("id", "1969519579") .param("level", "exhigh"); let result = client.song_url_v1(&query).await?; ``` -------------------------------- ### Get Songs by Style Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves songs associated with a specific music style. Supports pagination and sorting by popularity or recency. ```rust let query = Query::new().param("tagId", "1000"); let result = client.style_song(&query).await.unwrap(); ``` ```rust let query = Query::new() .param("tagId", "1010") .param("sort", "1"); let result = client.style_song(&query).await.unwrap(); ``` -------------------------------- ### Get Client Song Download URL Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the download URL for a song, allowing non-VIP users to download lossless quality. Requires a song ID and optionally a bitrate. ```rust let query = Query::new().param("id", "1969519579"); let result = client.song_download_url(&query).await?; ``` -------------------------------- ### Get recommended related playlists Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieve recommendations for related playlists based on a given playlist ID. ```rust let query = Query::new().param("id", "8039587836"); let result = client.playlist_detail_rcmd_get(&query).await?; ``` -------------------------------- ### Get Yunbei Expenses Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to retrieve Yunbei expenses. Optional parameters include 'limit' for the number of items and 'offset' for the starting position. ```Rust let query = Query::new().param("limit", "1"); let result = client.yunbei_expense(&query).await.unwrap(); ``` -------------------------------- ### Run NCM API Rust SDK HTTP Server (Windows) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md On Windows, extract the downloaded zip file. You can then run the server by double-clicking the executable or by executing it from a command prompt. ```bash ncm-server.exe ``` -------------------------------- ### Get Cloud Upload Token Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Obtain an upload token for direct client uploads. Requires file MD5, size, and filename. ```rust let query = Query::new() .param("md5", "d02b8ab79d91c01167ba31e349fe5275") .param("fileSize", "50412168") .param("filename", "song.mp3"); let result = client.cloud_upload_token(&query).await.unwrap(); ``` -------------------------------- ### Get Top MVs Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches a list of top MVs, with options to limit the number of results and filter by area. ```rust let query = Query::new().param("limit", "10"); let result = client.top_mv(&query).await?; ``` -------------------------------- ### Get Video Like/Share/Comment Counts Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the like, share, and comment counts for a given video ID. ```rust let query = Query::new().param("vid", "89ADDE33C0AAE8EC14B99F6750DB954D"); let result = client.video_detail_info(&query).await?; ``` -------------------------------- ### Get playlist dynamic details Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieve dynamic details of a playlist, such as comment count, subscription status, and play count. ```rust let query = Query::new().param("id", "24381616"); let result = client.playlist_detail_dynamic(&query).await?; ``` -------------------------------- ### Get Threshold Detail Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get threshold details. Requires a Query object. ```Rust let query = Query::new(); let result = client.threshold_detail_get(&query).await.unwrap(); ``` -------------------------------- ### Get Purchased Digital Albums Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of digital albums purchased by the user. Supports pagination. ```rust let query = Query::new().param("limit", "10"); let result = client.digital_album_purchased(&query).await.unwrap(); ``` -------------------------------- ### Compile and Run HTTP Server Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Instructions for compiling and running the ncm-api-rs project as an HTTP server using Cargo. The server defaults to listening on 0.0.0.0:3000. ```bash # 编译并运行(默认监听 0.0.0.0:3000) cargo run --features server --bin ncm-server # 或先编译再运行 cargo build --release --features server --bin ncm-server ./target/release/ncm-server ``` -------------------------------- ### Get Recent Listening List Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your recently listened to songs list. ```Rust let query = Query::new(); let result = client.recent_listen_list(&query).await.unwrap(); ``` -------------------------------- ### Get Internal Version Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get the internal version number. Requires a Query object. ```Rust let query = Query::new(); let result = client.inner_version(&query).await.unwrap(); ``` -------------------------------- ### Configure Request Proxy Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Shows how to set up a proxy for a specific request by providing the proxy URL in the Query parameters. Supports HTTP and SOCKS5 proxies. ```rust let mut query = Query::new().param("id", "33894312"); query.proxy = Some("http://121.196.226.246:84".to_string()); // 也支持 socks5 代理 // query.proxy = Some("socks5://127.0.0.1:1080".to_string()); let result = client.song_url(&query).await?; ``` -------------------------------- ### Get Today's Listened Songs Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint after logging in to get the songs you listened to today. ```Rust let query = Query::new(); let result = client.listen_data_today_song(&query).await.unwrap(); ``` -------------------------------- ### NCM API Rust SDK Query Parameter Configuration Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Illustrates how to use the `Query` object for API requests, including setting business parameters, overriding cookies, and configuring network options like proxy and IP spoofing. ```rust let mut query = Query::new() // 业务参数 - 对应 Node.js 版本中 req.query 传入的参数 .param("id", "186016") .param("limit", "30") .param("offset", "0") // 可选:覆盖 cookie .cookie("MUSIC_U=xxx"); // 可选:设置代理 query.proxy = Some("socks5://127.0.0.1:1080".to_string()); // 可选:设置真实 IP(伪装 X-Real-IP 请求头) query.real_ip = Some("116.25.146.177".to_string()); // 可选:使用随机中国 IP query.random_cn_ip = true; // 读取参数 query.get("id"); // Some("186016") query.get_or("limit", "30"); // "30" ``` -------------------------------- ### Get Happy Sign Information Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get happy sign information. Requires a Query object. ```Rust let query = Query::new(); let result = client.sign_happy_info(&query).await.unwrap(); ``` -------------------------------- ### Get all songs in a playlist Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieve all songs within a playlist, overcoming the Netease Cloud Music API's limitation of returning only 10 songs in the playlist details. You can specify limit and offset for pagination. ```rust let query = Query::new().param("id", "24381616").param("limit", "10").param("offset", "0"); let result = client.playlist_track_all(&query).await?; ``` -------------------------------- ### Complete Cloud Upload Import Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Finalize a file upload and import it as a song. Optional parameters include song title, artist, and album. ```rust let query = Query::new() .param("songId", "123456") .param("resourceId", "res_123") .param("md5", "d02b8ab79d91c01167ba31e349fe5275") .param("filename", "song.mp3") .param("song", "歌曲名") .param("artist", "歌手名"); let result = client.cloud_upload_complete(&query).await.unwrap(); ``` -------------------------------- ### Get Song URL via 302 Redirect (New Version) Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Obtains the playback URL for a song using a 302 redirect. Accepts a single song ID and playback quality level. ```rust let query = Query::new() .param("id", "1969519579") .param("level", "exhigh"); let result = client.song_url_v1_302(&query).await?; ``` -------------------------------- ### Login and Save Cookie Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Demonstrates how to log in using a phone number and password, retrieve the cookie from the response, and use it for subsequent authenticated requests. ```rust let query = Query::new() .param("phone", "13xxx") .param("password", "xxx"); let result = client.login_cellphone(&query).await?; let cookies = result.cookie.join("; "); let query = Query::new().cookie(&cookies); let account = client.user_account(&query).await?; ``` -------------------------------- ### Get Broadcast Radio Favorites Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get your favorite broadcast radio stations. An optional 'limit' parameter defaults to 99999. ```Rust let query = Query::new(); let result = client.broadcast_channel_collect_list(&query).await.unwrap(); ``` -------------------------------- ### Get Hot Events for Topic Detail Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get hot events for a topic detail. Requires the 'actid' parameter for the topic ID. ```Rust let query = Query::new().param("actid", "111551188"); let result = client.topic_detail_event_hot(&query).await.unwrap(); ``` -------------------------------- ### Create a new playlist Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Create a new playlist by providing a name. Optionally, you can set it as private or specify its type (e.g., VIDEO, SHARED). ```rust let query = Query::new().param("name", "测试歌单"); let result = client.playlist_create(&query).await?; // 创建视频歌单 let query = Query::new().param("name", "test").param("type", "VIDEO"); let result = client.playlist_create(&query).await?; ``` -------------------------------- ### Get Broadcast Radio Channel Information Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface with a station ID to get broadcast radio station information. Requires the 'id' parameter. ```Rust let query = Query::new().param("id", "5"); let result = client.broadcast_channel_currentinfo(&query).await.unwrap(); ``` -------------------------------- ### Integrate NCM API into Axum Project Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Shows how to integrate the ncm-api-rs library directly into an existing Axum web server project. Provides two methods: a quick build and a custom configuration approach. ```rust use ncm_api_rs::{create_client, server::{build_app, build_app_with_config, ServerConfig}}; // 方式一:快速构建 let app = build_app(create_client(None)); // 方式二:自定义配置 let config = ServerConfig { host: "127.0.0.1".to_string(), port: 8080, cors_origin: Some("http://localhost:5173".to_string()), }; let app = build_app_with_config(create_client(None), &config); // 启动 let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?; axum::serve(listener, app).await?; ``` -------------------------------- ### Get All Broadcast Radio Channels Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get all broadcast radio channels. Optional parameters include categoryId and regionId, defaulting to 0. ```Rust let query = Query::new(); let result = client.broadcast_channel_list(&query).await.unwrap(); ``` -------------------------------- ### video_timeline_recommend Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Fetches a list of recommended videos, paginated by offset. ```APIDOC ## video_timeline_recommend ### Description Fetches a list of recommended videos, paginated by offset. ### Method Not specified (assumed to be part of an SDK) ### Parameters #### Query Parameters - **offset** (string) - Optional - Offset for pagination, defaults to 0. ### Request Example ```rust let query = Query::new().param("offset", "10"); let result = client.video_timeline_recommend(&query).await?; ``` ``` -------------------------------- ### Get Total Listening Time Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your total listening time. Note that related interfaces may require VIP privileges. ```Rust let query = Query::new(); let result = client.listen_data_total(&query).await.unwrap(); ``` -------------------------------- ### Use Direct Cookie Value Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Shows how to directly use a cookie value, specifically 'MUSIC_U', for requests when the full cookie string is not available or needed. ```rust let query = Query::new().cookie("MUSIC_U=xxxx"); ``` -------------------------------- ### Get Radio Broadcast Category and Region Info Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to get broadcast radio station category and region information. Requires a Query object. ```Rust let query = Query::new(); let result = client.broadcast_category_region_get(&query).await.unwrap(); ``` -------------------------------- ### playlist_create Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Creates a new playlist with specified name, privacy, and type. ```APIDOC ## playlist_create ### Description Calls this interface to create a new playlist by passing the playlist name. ### Method Not specified (assumed to be a client method call) ### Parameters #### Query Parameters - **name** (string) - Required - The name of the playlist. - **privacy** (string) - Optional - Whether to set the playlist as private. Pass '10' to set as private. Defaults to public. - **type** (string) - Optional - The type of the playlist. Defaults to 'NORMAL'. Pass 'VIDEO' for a video playlist or 'SHARED' for a shared playlist. ### Request Example ```rust // Create a normal playlist let query = Query::new().param("name", "测试歌单"); let result = client.playlist_create(&query).await?; // Create a video playlist let query = Query::new().param("name", "test").param("type", "VIDEO"); let result = client.playlist_create(&query).await?; ``` ### Response (Response details not specified in the source) ``` -------------------------------- ### Get Recently Played Playlists Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your recently played playlists. An optional 'limit' parameter can specify the number of results, defaulting to 100. ```Rust let query = Query::new().param("limit", "1"); let result = client.record_recent_playlist(&query).await.unwrap(); ``` -------------------------------- ### Get Recently Played Albums Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your recently played albums. An optional 'limit' parameter can specify the number of results, defaulting to 100. ```Rust let query = Query::new().param("limit", "1"); let result = client.record_recent_album(&query).await.unwrap(); ``` -------------------------------- ### Enable Random Chinese IP Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Demonstrates how to enable the 'random_cn_ip' feature to automatically use a random Chinese IP address for requests, eliminating the need to manually specify one. ```rust let mut query = Query::new().param("id", "1969519579"); query.random_cn_ip = true; let result = client.song_url_v1(&query).await?; ``` -------------------------------- ### Get Recently Played Songs Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your recently played songs. An optional 'limit' parameter can specify the number of results, defaulting to 100. ```Rust let query = Query::new().param("limit", "1"); let result = client.record_recent_song(&query).await.unwrap(); ``` -------------------------------- ### Recommend a Song for Yunbei Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to recommend a song for Yunbei, providing the song ID. Optional parameters include 'reason' and 'yunbeiNum'. ```Rust let query = Query::new().param("id", "65528"); let result = client.yunbei_rcmd_song(&query).await.unwrap(); ``` ```Rust let query = Query::new() .param("id", "65528") .param("reason", "人间好声音推荐给你听"); let result = client.yunbei_rcmd_song(&query).await.unwrap(); ``` -------------------------------- ### Get Weekly/Monthly/Yearly Listening Report Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint to get your listening report for the week, month, or year. The 'type' parameter specifies the dimension ('week', 'month', 'year'). 'endTime' can be used to specify the end of the period; otherwise, it defaults to the current week/month. ```Rust let query = Query::new().param("type", "month"); let result = client.listen_data_report(&query).await.unwrap(); ``` -------------------------------- ### NCM API Rust SDK Usage with Cookies for Authenticated APIs Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Shows how to create a client with authentication cookies or pass cookies directly within the Query object to access user-specific or protected API endpoints. ```rust use ncm_api_rs::{create_client, Query}; #[tokio::main] async fn main() { // 方式一:创建客户端时传入 cookie let client = create_client(Some("MUSIC_U=xxx; __csrf=xxx".to_string())); let query = Query::new(); let songs = client.recommend_songs(&query).await.unwrap(); // 方式二:在 Query 中传入 cookie(覆盖客户端 cookie) let query = Query::new().cookie("MUSIC_U=xxx; __csrf=xxx"); let fm = client.personal_fm(&query).await.unwrap(); } ``` -------------------------------- ### Get Recent Contacts Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieve a list of recent contacts. ```rust let query = Query::new(); let result = client.msg_recentcontact(&query).await.unwrap(); ``` -------------------------------- ### Set realIP for Requests Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md Explains how to set the 'real_ip' parameter to a specific IP address, useful when running on servers outside of China or on platforms like Vercel. ```rust let mut query = Query::new().param("id", "1969519579"); query.real_ip = Some("116.25.146.177".to_string()); let result = client.song_url_v1(&query).await?; ``` -------------------------------- ### Add a video to a video playlist Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Add a video to a video playlist. Requires user login. Specify the playlist ID and the video ID(s). ```rust let query = Query::new().param("pid", "5271999357").param("ids", "186041"); let result = client.playlist_track_add(&query).await?; ``` -------------------------------- ### Correct Cloud Disk Song Information Match Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Use this to correct cloud disk song information matching. To cancel a match, set 'asid' to 0. ```rust let query = Query::new() .param("uid", "32953014") .param("sid", "aaa") .param("asid", "bbb"); let result = client.cloud_match(&query).await.unwrap(); // 取消匹配 let query = Query::new() .param("uid", "32953014") .param("sid", "bbb") .param("asid", "0"); let result = client.cloud_match(&query).await.unwrap(); ``` -------------------------------- ### Log Upload Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface to upload logs. Requires a Query object. ```Rust let query = Query::new(); let result = client.weblog(&query).await.unwrap(); ``` -------------------------------- ### Batch Request API Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this interface after logging in to batch request multiple APIs with their respective original parameters. Requires a Query object. ```Rust let query = Query::new(); let result = client.batch(&query).await.unwrap(); ``` -------------------------------- ### Get Related Videos Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves videos related to a given video ID. ```rust let query = Query::new().param("id", "89ADDE33C0AAE8EC14B99F6750DB954D"); let result = client.related_allvideo(&query).await?; ``` -------------------------------- ### voice_upload Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Uploads audio content to a podcast. Requires various IDs for podcast, cover, and categories, along with a description. ```APIDOC ## voice_upload - 播客上传声音 ### Description Uploads audio content to a podcast. Requires various IDs for podcast, cover, and categories, along with a description. ### Method Not specified (assumed to be POST based on context) ### Endpoint Not specified ### Parameters #### Query Parameters - **voiceListId** (string) - Required - The ID of the podcast. - **coverImgId** (string) - Required - The ID of the podcast cover image. - **categoryId** (string) - Required - The ID of the category. - **secondCategoryId** (string) - Required - The ID of the secondary category. - **description** (string) - Required - A description of the audio content. - **songName** (string) - Optional - The name of the audio. - **privacy** (string) - Optional - Set to private (value not specified). - **publishTime** (string) - Optional - Timestamp for scheduled publishing. - **autoPublish** (string) - Optional - Set to 1 to publish as a dynamic update. - **autoPublishText** (string) - Optional - Text for the dynamic update. - **orderNo** (string) - Optional - Order number, defaults to 1. - **composedSongs** (string) - Optional - IDs of included songs, separated by commas. ### Request Example ```rust let query = Query::new() .param("voiceListId", "123456") .param("coverImgId", "789") .param("categoryId", "1") .param("secondCategoryId", "2") .param("description", "声音介绍"); let result = client.voice_upload(&query).await.unwrap(); ``` ``` -------------------------------- ### Perform Yunbei Sign-in Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Call this endpoint after logging in to perform the Yunbei sign-in. ```Rust let query = Query::new(); let result = client.yunbei_sign(&query).await.unwrap(); ``` -------------------------------- ### cloud_match Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Allows users to match or correct cloud disk song information after logging in. To cancel a match, set the `asid` parameter to 0. ```APIDOC ## cloud_match - 云盘歌曲信息匹配纠正 ### Description Allows users to match or correct cloud disk song information after logging in. To cancel a match, set the `asid` parameter to 0. ### Method POST (assumed based on typical API patterns for modification) ### Endpoint `/cloud_match` (assumed based on method name) ### Parameters #### Path Parameters None #### Query Parameters - **uid** (string) - Required - User ID. - **sid** (string) - Required - Cloud disk song ID. - **asid** (string) - Required - The ID of the song to match. Set to '0' to cancel the match. ### Request Example ```rust let query = Query::new() .param("uid", "32953014") .param("sid", "aaa") .param("asid", "bbb"); let result = client.cloud_match(&query).await.unwrap(); // Cancel match let query = Query::new() .param("uid", "32953014") .param("sid", "bbb") .param("asid", "0"); let result = client.cloud_match(&query).await.unwrap(); ``` ### Response #### Success Response (200) Details not provided in source. ``` -------------------------------- ### Match local song files with Netease Cloud Music information Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md This function matches local song files with Netease Cloud Music song IDs, album art, and other details. It requires title, album, artist, duration, and MD5 of the local file. ```rust let query = Query::new() .param("title", "富士山下") .param("album", "") .param("artist", "陈奕迅") .param("duration", "259.21") .param("md5", "bd708d006912a09d827f02e754cf8e56"); let result = client.search_match(&query).await?; ``` -------------------------------- ### search_match Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Searches for music information on NetEase Cloud Music for local song files. ```APIDOC ## search_match ### Description Calls this interface to search for song IDs, album art, and other information for local song files on NetEase Cloud Music. ### Method Not specified (assumed to be a client method call) ### Parameters #### Query Parameters - **title** (string) - Required - The title information of the file. - **album** (string) - Required - The album information of the file. - **artist** (string) - Required - The artist information of the file. - **duration** (string) - Required - The duration of the file in seconds. - **md5** (string) - Required - The MD5 hash of the file. ### Request Example ```rust let query = Query::new() .param("title", "富士山下") .param("album", "") .param("artist", "陈奕迅") .param("duration", "259.21") .param("md5", "bd708d006912a09d827f02e754cf8e56"); let result = client.search_match(&query).await?; ``` ### Response (Response details not specified in the source) ``` -------------------------------- ### Get Video Playback URL Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the playback URL for a specific video ID. ```rust let query = Query::new().param("id", "89ADDE33C0AAE8EC14B99F6750DB954D"); let result = client.video_url(&query).await?; ``` -------------------------------- ### Get Private Messages Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieve private messages. Supports limiting the number of results and offsetting. ```rust let query = Query::new().param("limit", "3"); let result = client.msg_private(&query).await.unwrap(); ``` -------------------------------- ### mlog_to_video Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Converts an mlog ID to its corresponding video ID, which can then be used to get the playback URL. ```APIDOC ## mlog_to_video ### Description Converts an mlog ID to its corresponding video ID, which can then be used to get the playback URL. ### Method Not specified (assumed to be part of an SDK) ### Parameters #### Query Parameters - **id** (string) - Required - Mlog ID ### Request Example ```rust let query = Query::new().param("id", "a1qOVPTWKS1ZrK8"); let result = client.mlog_to_video(&query).await?; ``` ``` -------------------------------- ### Order Digital Album Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Initiates the purchase of a digital album. Requires user login and specifies payment method and quantity. ```rust let query = Query::new() .param("id", "86286082") .param("payment", "3") .param("quantity", "1"); let result = client.digital_album_ordering(&query).await.unwrap(); ``` -------------------------------- ### calendar Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the music calendar for a logged-in user. Requires start and end time parameters. ```APIDOC ## calendar - 音乐日历 ### Description Retrieves the music calendar for a logged-in user. Requires start and end time parameters. ### Method Not specified (Rust client method) ### Endpoint Not specified ### Parameters #### Query Parameters - **startTime** (timestamp) - Optional - The start timestamp for the calendar data. - **endTime** (timestamp) - Optional - The end timestamp for the calendar data. ### Request Example ```rust let query = Query::new() .param("startTime", "1606752000000") .param("endTime", "1609430399999"); let result = client.calendar(&query).await.unwrap(); ``` ### Response Success response details are not specified. ``` -------------------------------- ### style_preference Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves the user's music style preferences (requires login). ```APIDOC ## style_preference - 曲风偏好 ### Description Retrieves the user's music style preferences (requires login). ### Method Not specified (assumed to be GET based on context) ### Endpoint Not specified ### Parameters None ### Request Example ```rust let query = Query::new(); let result = client.style_preference(&query).await.unwrap(); ``` ``` -------------------------------- ### Add ncm-api-rs from Git as a Rust Library Dependency Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/README.md To use the latest version directly from the Git repository, specify the git source in your Cargo.toml. This is useful for testing unreleased features. ```toml [dependencies] ncm-api-rs = { git = "https://github.com/SPlayer-Dev/ncm-api-rs.git" } tokio = { version = "1", features = ["full"] } ``` -------------------------------- ### Check Music Availability Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Verifies if a song is available for playback. Returns a success status and a message indicating availability or copyright issues. Optionally accepts a bitrate. ```rust let query = Query::new().param("id", "1969519579"); let result = client.check_music(&query).await?; ``` -------------------------------- ### Upload Podcast Voice Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Uploads a voice recording to a podcast. Requires various IDs for the podcast, cover, and categories, along with a description. ```rust let query = Query::new() .param("voiceListId", "123456") .param("coverImgId", "789") .param("categoryId", "1") .param("secondCategoryId", "2") .param("description", "声音介绍"); let result = client.voice_upload(&query).await.unwrap(); ``` -------------------------------- ### yunbei_tasks Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of all available Yunbei tasks. ```APIDOC ## yunbei_tasks - 云贝所有任务 ### Description Retrieves a list of all available Yunbei tasks. ### Method Not specified (assumed to be part of a client method call). ### Endpoint Not specified. ### Parameters No parameters are explicitly listed for this operation in the provided text. ### Request Example ```rust let query = Query::new(); let result = client.yunbei_tasks(&query).await.unwrap(); ``` ### Response Details not provided in the source. ``` -------------------------------- ### Get Recent Video Plays Source: https://github.com/splayer-dev/ncm-api-rs/blob/main/docs/API.md Retrieves a list of recently played videos. Supports limiting the number of results. ```rust let query = Query::new().param("limit", "1"); let result = client.record_recent_video(&query).await.unwrap(); ```