discord-player-deezer 2.0.0-dev.4 → 2.0.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -110,10 +110,9 @@ async function streamTrack(track, ext) {
|
|
|
110
110
|
})
|
|
111
111
|
});
|
|
112
112
|
const trackInfo = await trackInfoRes.json();
|
|
113
|
-
if (Array.isArray(trackInfo.error) && trackInfo.error.length !== 0) throw new Error("Unable to extract track\n" + JSON.stringify(trackInfo.error));
|
|
114
|
-
if (typeof trackInfo.error === "object" && Object.keys(trackInfo.error).length !== 0) throw new Error("Unable to extract track\n" + JSON.stringify(trackInfo.error));
|
|
115
113
|
const info = trackInfo.results.data[0];
|
|
116
|
-
|
|
114
|
+
ext.context.player.debug(`ATTEMPTING TO EXTRACT STREAM WITH { licenseToken: ${ext.userInfo.licenseToken}, trackToken: ${info.TRACK_TOKEN} }`);
|
|
115
|
+
const streamInfoRes = await fetch("https://media.deezer.com/v1/get-url", {
|
|
117
116
|
method: "POST",
|
|
118
117
|
body: JSON.stringify({
|
|
119
118
|
license_token: ext.userInfo.licenseToken,
|
|
@@ -134,13 +133,8 @@ async function streamTrack(track, ext) {
|
|
|
134
133
|
}]
|
|
135
134
|
}],
|
|
136
135
|
track_tokens: [info.TRACK_TOKEN]
|
|
137
|
-
})
|
|
138
|
-
headers: {
|
|
139
|
-
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0",
|
|
140
|
-
"Content-Type": "application/json"
|
|
141
|
-
}
|
|
136
|
+
})
|
|
142
137
|
});
|
|
143
|
-
ext.context.player.debug(await streamInfoRes.text());
|
|
144
138
|
const streamInfo = await streamInfoRes.json();
|
|
145
139
|
const trackMediaUrl = streamInfo.data[0].media[0].sources[0].url;
|
|
146
140
|
ext.context.player.debug("DEEZER FOUND MEDIA URL " + trackMediaUrl);
|
package/package.json
CHANGED