Skip to content

feat(lyrics-plus): change Musixmatch API for higher rate limit#3790

Merged
rxri merged 2 commits intospicetify:mainfrom
ianz56:feat/api-mxm
Apr 15, 2026
Merged

feat(lyrics-plus): change Musixmatch API for higher rate limit#3790
rxri merged 2 commits intospicetify:mainfrom
ianz56:feat/api-mxm

Conversation

@ianz56
Copy link
Copy Markdown
Contributor

@ianz56 ianz56 commented Apr 9, 2026

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

  • Bug Fixes
    • Improved reliability of lyrics and karaoke synchronization, translation retrieval, language detection, and token refresh so content loads more consistently and stays in sync.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

This change switches Musixmatch API calls in the lyrics-plus custom app from the desktop API host (apic-desktop.musixmatch.com, app_id=web-desktop-app-v1.0) to the mobile API host (apic-appmobile.musixmatch.com, app_id=mac-ios-v2.0) and replaces desktop-style headers with mobile-style HTTP headers in the provider and settings modules.

Changes

Cohort / File(s) Summary
Musixmatch Provider Updates
CustomApps/lyrics-plus/ProviderMusixmatch.js
Repointed lyrics/lyrics richsync, karaoke richsync, translations, and language requests to https://apic-appmobile.musixmatch.com; updated app_id to mac-ios-v2.0; replaced desktop headers (authority, cookie) with mobile-style headers (Host, authority, X-Cookie, x-mxm-app-version, X-User-Agent, Accept-Language, Connection, Accept).
Musixmatch Settings Updates
CustomApps/lyrics-plus/Settings.js
Changed token refresh request to https://apic-appmobile.musixmatch.com/ws/1.1/token.get?app_id=mac-ios-v2.0; expanded request headers to include mobile-style fields (Host, authority, X-Cookie placeholder, x-mxm-app-version, X-User-Agent, Accept-Language, Connection, Accept).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • rxri

Poem

🐰 I hopped to the mobile API gate,

Headers swapped and endpoints straight,
Lyrics now hum on a friendlier track,
Tokens refreshed, no looking back,
A tiny hop — the app sings back. 🎶

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: switching from the desktop Musixmatch API endpoint to the mobile endpoint to increase rate limits.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 in CustomApps/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

📥 Commits

Reviewing files that changed from the base of the PR and between a1cf6d8 and 24ba8bf.

📒 Files selected for processing (2)
  • CustomApps/lyrics-plus/ProviderMusixmatch.js
  • CustomApps/lyrics-plus/Settings.js

Comment thread CustomApps/lyrics-plus/ProviderMusixmatch.js
Comment thread CustomApps/lyrics-plus/ProviderMusixmatch.js Outdated
Comment thread CustomApps/lyrics-plus/ProviderMusixmatch.js Outdated
Comment thread CustomApps/lyrics-plus/Settings.js Outdated
Comment thread CustomApps/lyrics-plus/Settings.js Outdated
Co-authored-by: ririxi <dev@ririxi.dev>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 24ba8bf and 4dfc632.

📒 Files selected for processing (2)
  • CustomApps/lyrics-plus/ProviderMusixmatch.js
  • CustomApps/lyrics-plus/Settings.js
✅ Files skipped from review due to trivial changes (1)
  • CustomApps/lyrics-plus/ProviderMusixmatch.js

@rxri rxri merged commit b5de1e5 into spicetify:main Apr 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants