/* probe_fix.c — 真机验证修复:复刻 appstate_load_playlist_songs_page(offset=0) 的完整数据路径 * /api/v6/playlist/detail(trackIds) → /api/v3/song/detail 分批 → 打印曲目。 * 与 App 相同的 core 调用(App 端 appstate 修复即按此路径)。请求量:detail 1 + song_detail 1 = 2。 * 用法: probe_fix */ #include "ncm.h" #include "ncm_api.h" #include "ncm_common.h" #include "ncm_http.h" #include #include static ncm_ctx_t ncm_ctx; int main(int argc, char **argv) { const char *data_dir = argc > 1 ? argv[1] : "/usr/data/mnt/sd_0/MeowData/dev.player.ncm/data"; const char *cacert = argc > 2 ? argv[2] : "/usr/data/mnt/sd_0/MeowAPPs/dev.player.ncm/cacert.pem"; const char *pid = argc > 3 ? argv[3] : "18206253175"; ncm_ctx_init(&ncm_ctx, data_dir); printf("device_id=%s cookie_len=%zu\n", ncm_ctx.device_id, strlen(ncm_ctx.cookie)); ncm_http_set_verify_default(1, cacert); int64_t ids[256]; int idn = 0; long t0 = (long)ncm_now_ms(); int rc = ncm_api_playlist_detail(ncm_ctx.device_id, ncm_ctx.cookie, pid, NULL, 0, NULL, 0, ids, 256, &idn); long dt = (long)ncm_now_ms() - t0; printf("detail rc=%d elapsed_ms=%ld idn=%d ids[0]=%lld\n", rc, dt, idn, idn>0?(long long)ids[0]:-1); if (rc != NCM_OK) { printf("FIX VERIFY FAILED (detail)\n"); return 1; } ncm_song_t songs[256]; memset(songs, 0, sizeof songs); int outn = 0; for (int off = 0; off < idn; off += 64) { int batch = idn - off; if (batch > 64) batch = 64; int bn = 0; t0 = (long)ncm_now_ms(); rc = ncm_api_song_detail(ncm_ctx.device_id, ncm_ctx.cookie, &ids[off], batch, &songs[off], 256 - off, &bn); printf(" song off=%d batch=%d rc=%d elapsed_ms=%ld bn=%d\n", off, batch, rc, (long)ncm_now_ms() - t0, bn); if (rc != NCM_OK) break; outn += bn; if (bn < batch) break; } printf("RESULT song_count=%d\n", outn); if (outn > 0) printf(" [0] %s / %s / %s\n", songs[0].name, songs[0].art_name, songs[0].album_name); if (rc != NCM_OK || outn == 0) { printf("FIX VERIFY FAILED (songs)\n"); return 1; } printf("FIX VERIFY OK\n"); return 0; }