依据用户提供的 HAR(e.ac19.cn, Reqable): 原版客户端是三步
1) POST /api.php action=get_config&device_id=<mac> (表单 + Dalvik UA)
2) GET /i.php 参数与 App 完全一致
3) GET /music/do.php 参数与 App 完全一致, 返回真源 CDN 地址
发现并修复三处差异:
1. 我们从未调 api.php(原版取址前必调)
→ KtvJsBridge.rawCleanPost(): 干净 POST + Content-Type 表单 + Dalvik UA
(UA 由本机 Build.VERSION.RELEASE/MODEL/ID 拼出, 与 HAR 同形态)
→ SongUrlResolver.ensureConfig(): 缓存 30 分钟, 桥不可用则跳过
→ SongApiClient 注入 POST 通道
2. 风控拒绝的真实形态是 HTTP 200 + 业务码 403
{"code":403,"msg":"请求被拒绝:检测到异常行为"} —— 不是 HTTP 403
→ i.php / do.php 两处业务码 403 都置 sawForbidden(诊断不再误判为"没有地址")
3. 无视试用配额: api.php 给出 trial_times=2 / trial_duration=5
→ 一次取址最多尝试 trial_times 个源(原先 9 个源全扫会把额度瞬间打光)
请求头分工与 HAR 一致: i.php/do.php 只有 Host+Accept 的干净 GET;
仅 api.php 带表单 Content-Type 与 Dalvik UA。
日志: 远程一条 SOURCE-CONFIG trial_enabled=… trial_times=…; 原始 JSON/卡密提示只写本地。
本机实测: api.php 返回与 HAR 相同配置; do.php 返回 code=403 检测到异常行为
(本出口 IP 处于风控/未授权: network_verification=true + 卡密机制, 额度按 IP 计)。
版本号按规则 3: 1.5.8(40) → 1.5.9(41); 按要求未打包
验证: compileReleaseKotlin + 单元测试(9 例全过)
Maidong KTV
A local karaoke application for Android TV and landscape song-selection devices
Remote Control · Song Discovery · Request Queue · Download Management · Stable Playback
Core Features
- Full TV remote navigation with directional keys, confirmation, back, and long-press actions.
- Consistent focus feedback for buttons, lists, cards, switches, and dialogs.
- Home entries for charts, song titles, singers, frequently played songs, favorites, categories, and local songs.
- Online and local search with language filters, paging, and initial-letter keyboard input.
- Singer browsing with portrait tags and singer-specific song lists.
- Song ordering, batch ordering, queue prioritization, favorites, and file management.
- Real-time synchronization across queued, played, and downloaded song lists.
- New requests join the end of the queue without interrupting the current requested song.
- Automatic playback when requested songs are available, including smooth transitions from public playback.
Playback
- IJK-based playback for local and downloaded songs.
- Continuous playback while navigating between pages or switching between windowed and full-screen modes.
- Play, pause, skip, replay, progress display, and seeking controls.
- Original-vocal and accompaniment switching without changing the current play or pause state.
- Synchronized playback state across windowed controls, full-screen controls, and status overlays.
- Song title overlays, temporary mode prompts, and persistent pause indicators.
- Video ratio, automatic full screen, audio-video synchronization, and public playback settings.
- Maximum song volume and configurable original-vocal and accompaniment behavior.
Downloads And Data
- Background downloads with progress, resume support, and automatic retry.
- Automatic cleanup and retry after download or decryption failures.
- Recognition, counting, and playback of downloaded local songs.
- Segmented database download, verification, merge, and atomic update.
- Directory creation, database scanning, and download startup only after storage permission is granted.
- Local disk and USB song scanning, reserved storage settings, and automatic cleanup.
- Unified Maidong KTV data storage to avoid conflicts with other applications.
Settings
- Data settings for library updates, local scanning, reserved space, automatic cleanup, and database maintenance.
- Playback settings for public playback, automatic full screen, video ratio, synchronization, and title overlays.
- Sound settings for volume behavior, maximum song volume, original vocals, and accompaniment.
- Interface settings for language, floating controls, carousel content, and song title overlays.
- Dialog selections remain temporary until confirmed and provide clear remote-control focus feedback.
Interface And Interaction
- Landscape TV layout optimized for long-distance viewing.
- Consistent state and meaning across top, windowed, and full-screen playback controls.
- Stable focus during list refreshes, paging, tab changes, and song ordering.
- Focus changes color only and preserves each control's original dimensions, corners, and layout.
- A consistent circular Maidong logo across the home screen, player, and application information.
Project Notice
This repository: https://gitea.kasugano.cn/zijunchiang/maidong-ktv
UI/feature framework credit: https://gitee.com/yangyachao-X/maidong-ktv
This repository reworks the upstream "Maidong KTV" UI and feature framework, and the core/data layer was rewritten with DSH (DeepSeek Harness): library sync, song-source integration, device auth, risk-control handling, remote logging, and ad blocking are all new implementations.
Highlights of the reworked data layer:
- Library: synced exclusively from the official Muse service
(
mconn.cherryonline.cnmls-api/v1/sqlite/sync); the code host carries source only, no database files. - Song source:
w.w345.my(i.phptoken →do.phpplayback URL) with fixed device identity and reproduced signing; ad/mismatched resources (e.g.wb66.cn/.../719.ts) are blocked and retried. - JS hot-update:
app/src/main/assets/mobile/ktv_api.js, requires theKTV_BRIDGE_API: 7marker.
Building
Requirements: JDK 17, Android SDK (compileSdk 35, minSdk 21, targetSdk 25),
Gradle wrapper 8.13 (bundled).
cd maidong-ktv
export JAVA_HOME=/path/to/jdk-17
export ANDROID_HOME=/path/to/android-sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
./gradlew assembleRelease
The release signing config in app/build.gradle expects ../../ktv_keystore.jks (one level above the
repo root) with alias ktv / password 123456; adjust paths or use signingConfigs.debug for a
quick unsigned build. Output: app/build/outputs/apk/release/app-release.apk
(dual ABI: armeabi-v7a + arm64-v8a). Install with adb install -r <apk>.
For non-commercial learning purposes only. Respect upstream copyright and song licensing.
