Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions CustomApps/lyrics-plus/ProviderMusixmatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const ProviderMusixmatch = (() => {
q_duration: durr,
f_subtitle_length: Math.floor(durr),
usertoken: CONFIG.providers.musixmatch.token,
optional_calls: "track.richsync",
richsync_compact_type: "words",
part: "track_lyrics_translation_status,track_structure,track_performer_tagging",
};

Expand Down Expand Up @@ -231,28 +233,12 @@ const ProviderMusixmatch = (() => {
return null;
}

const baseURL = "https://apic-appmobile.musixmatch.com/ws/1.1/track.richsync.get?format=json&subtitle_format=mxm&app_id=mac-ios-v2.0&";

const params = {
f_subtitle_length: meta.track.track_length,
q_duration: meta.track.track_length,
commontrack_id: meta.track.commontrack_id,
usertoken: CONFIG.providers.musixmatch.token,
};

const finalURL =
baseURL +
Object.keys(params)
.map((key) => `${key}=${encodeURIComponent(params[key])}`)
.join("&");

let result = await Spicetify.CosmosAsync.get(finalURL, null, headers);

if (result.message.header.status_code !== 200) {
const richsyncCall = body?.["track.richsync.get"];
if (!richsyncCall || richsyncCall.message.header.status_code !== 200 || !richsyncCall.message.body.richsync) {
return null;
}

result = result.message.body;
const result = richsyncCall.message.body;

const snippetQueue = parsePerformerData(meta);

Expand Down