feat(lyrics-plus): change Musixmatch API for higher rate limit#3790
feat(lyrics-plus): change Musixmatch API for higher rate limit#3790rxri merged 2 commits intospicetify:mainfrom
Conversation
📝 WalkthroughWalkthroughThis change switches Musixmatch API calls in the lyrics-plus custom app from the desktop API host ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
CustomApps/lyrics-plus/ProviderMusixmatch.js (1)
3-10: Consolidate Musixmatch request profile to avoid config drift.
Host,authority, app version, and UA are now hardcoded here and duplicated inCustomApps/lyrics-plus/Settings.js(Line 75-84). Centralizing these values (host/app_id/headers) in one shared constant will prevent subtle breakage when one location changes and the other does not.♻️ Suggested direction
+// e.g. in a shared module +export const MUSIXMATCH_MOBILE = { + host: "apic-appmobile.musixmatch.com", + appId: "mac-ios-v2.0", + headers: { + Host: "apic-appmobile.musixmatch.com", + authority: "apic-appmobile.musixmatch.com", + cookie: "x-mxm-token-guid=", + "x-mxm-app-version": "10.1.1", + "User-Agent": "Musixmatch/2025120901 CFNetwork/3860.300.31 Darwin/25.2.0", + "Accept-Language": "en-US,en;q=0.9", + Connection: "keep-alive", + Accept: "application/json", + }, +};🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CustomApps/lyrics-plus/ProviderMusixmatch.js` around lines 3 - 10, The hardcoded Musixmatch request profile in ProviderMusixmatch.js (Host, authority, cookie key, "x-mxm-app-version", "User-Agent", Accept-Language, Connection, Accept) is duplicated with values in Settings.js; extract these values into a single shared constant (e.g., MUSIXMATCH_HEADERS or MUSIXMATCH_CONFIG) placed in Settings.js (or a new shared constants module), export it, and import it into ProviderMusixmatch.js so both ProviderMusixmatch.js and Settings.js reference the same exported symbol; ensure the header keys ("Host"/"authority"/"x-mxm-app-version"/"User-Agent") and any app_id or cookie name are removed from inline literals and replaced with the imported constant to eliminate drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@CustomApps/lyrics-plus/ProviderMusixmatch.js`:
- Around line 3-10: The hardcoded Musixmatch request profile in
ProviderMusixmatch.js (Host, authority, cookie key, "x-mxm-app-version",
"User-Agent", Accept-Language, Connection, Accept) is duplicated with values in
Settings.js; extract these values into a single shared constant (e.g.,
MUSIXMATCH_HEADERS or MUSIXMATCH_CONFIG) placed in Settings.js (or a new shared
constants module), export it, and import it into ProviderMusixmatch.js so both
ProviderMusixmatch.js and Settings.js reference the same exported symbol; ensure
the header keys ("Host"/"authority"/"x-mxm-app-version"/"User-Agent") and any
app_id or cookie name are removed from inline literals and replaced with the
imported constant to eliminate drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b8db1a30-7b39-4d14-a63a-ed1fbc19a7d1
📒 Files selected for processing (2)
CustomApps/lyrics-plus/ProviderMusixmatch.jsCustomApps/lyrics-plus/Settings.js
Co-authored-by: ririxi <dev@ririxi.dev>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
CustomApps/lyrics-plus/Settings.js (1)
75-83: Extract the Musixmatch mobile request config into a shared constant.These lines duplicate the same host and mobile header fingerprint already defined in
CustomApps/lyrics-plus/ProviderMusixmatch.js:1-11. Since this PR is changing the client identity to affect rate limits, letting the two copies drift would make token refresh and lyric fetch behave differently. Please centralize the base URL / app id / headers and reuse them from both files.Proposed refactor
+// CustomApps/lyrics-plus/MusixmatchRequestConfig.js +export const MUSIXMATCH_MOBILE_APP_ID = "mac-ios-v2.0"; +export const MUSIXMATCH_MOBILE_BASE_URL = "https://apic-appmobile.musixmatch.com/ws/1.1"; +export const MUSIXMATCH_MOBILE_HEADERS = { + Host: "apic-appmobile.musixmatch.com", + authority: "apic-appmobile.musixmatch.com", + "X-Cookie": "x-mxm-token-guid=", + "x-mxm-app-version": "10.1.1", + "X-User-Agent": "Musixmatch/2025120901 CFNetwork/3860.300.31 Darwin/25.2.0", + "Accept-Language": "en-US,en;q=0.9", + Connection: "keep-alive", + Accept: "application/json", +};- Spicetify.CosmosAsync.get("https://apic-appmobile.musixmatch.com/ws/1.1/token.get?app_id=mac-ios-v2.0", null, { - Host: "apic-appmobile.musixmatch.com", - authority: "apic-appmobile.musixmatch.com", - "X-Cookie": "x-mxm-token-guid=", - "x-mxm-app-version": "10.1.1", - "X-User-Agent": "Musixmatch/2025120901 CFNetwork/3860.300.31 Darwin/25.2.0", - "Accept-Language": "en-US,en;q=0.9", - Connection: "keep-alive", - Accept: "application/json", - }) + Spicetify.CosmosAsync.get( + `${MUSIXMATCH_MOBILE_BASE_URL}/token.get?app_id=${MUSIXMATCH_MOBILE_APP_ID}`, + null, + MUSIXMATCH_MOBILE_HEADERS + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CustomApps/lyrics-plus/Settings.js` around lines 75 - 83, Extract the duplicated Musixmatch mobile request settings into a single exported constant (e.g., MUSIXMATCH_MOBILE_CONFIG or split constants MUSIXMATCH_BASE_URL and MUSIXMATCH_MOBILE_HEADERS) and import it where needed; replace the hardcoded values used in Spicetify.CosmosAsync.get in Settings.js and the duplicated header block in ProviderMusixmatch.js with references to that shared constant so both token.get and lyric fetch use the identical base URL/app_id and header fingerprint.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@CustomApps/lyrics-plus/Settings.js`:
- Around line 75-83: Extract the duplicated Musixmatch mobile request settings
into a single exported constant (e.g., MUSIXMATCH_MOBILE_CONFIG or split
constants MUSIXMATCH_BASE_URL and MUSIXMATCH_MOBILE_HEADERS) and import it where
needed; replace the hardcoded values used in Spicetify.CosmosAsync.get in
Settings.js and the duplicated header block in ProviderMusixmatch.js with
references to that shared constant so both token.get and lyric fetch use the
identical base URL/app_id and header fingerprint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a007e8a2-2642-47bb-85a1-7ffb67a10670
📒 Files selected for processing (2)
CustomApps/lyrics-plus/ProviderMusixmatch.jsCustomApps/lyrics-plus/Settings.js
✅ Files skipped from review due to trivial changes (1)
- CustomApps/lyrics-plus/ProviderMusixmatch.js
Modify the Musixmatch API to increase the request rate limit, so that a single token can handle more than 10 requests at the same time
References
Summary by CodeRabbit