fix: exact mid lookup via trackInfo API + --lrc for external lyrics#3
Open
CPbianma wants to merge 1 commit into
Open
fix: exact mid lookup via trackInfo API + --lrc for external lyrics#3CPbianma wants to merge 1 commit into
CPbianma wants to merge 1 commit into
Conversation
fix: use trackInfo API for exact mid lookup, add --lrc for external lyrics Replace the broken search-by-mid endpoint in fetch_song_detail with music.trackInfo.UniformRuleCtrl, which does exact mid matching. The old search API (music.search.SearchCgiService) performs fuzzy text matching on the query string — a mid like "0039MnYb0qxYhV" matches songs whose metadata contains "b0", returning completely unrelated results. This affected the decrypt path where only song_mid is available. Also add --lrc flag to decrypt, download, and album commands. When set, write_metadata dumps fetched lyrics as a sibling .lrc file (UTF-8, timed LRC with optional Chinese translation) alongside the audio file for external-lyric-aware players. Co-Authored-By: Claude <noreply@anthropic.com> @
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@
Summary
Two changes in one PR (supersedes both #1 and #2):
1. Fix: replace broken search-by-mid with exact trackInfo API
Root cause:
music.search.SearchCgiServiceperforms fuzzy text matching, not exact mid lookup. A mid like0039MnYb0qxYhVmatches the substringb0in unrelated song metadata. Neither iterating through results (the #1 approach) nor sanity-checking can work — the correct song is simply never in the result set.Fix: Replace
fetch_song_detailto usemusic.trackInfo.UniformRuleCtrl/CgiGetTrackInfo, which does exact matching by mid and always returns the correct track.2. Feature:
--lrcflag for external lyric filesAdds
--lrctodecrypt,download, andalbumcommands. When set,write_metadatawrites a sibling.lrcfile (UTF-8, timed LRC with optional Chinese translation) alongside the audio file.Testing
All metadata fields verified: title, artist, album, year, genre, language, track/disc numbers, cover art, lyrics.
🤖 Generated with Claude Code
@