soundcloud: use startsWith instead of substring

This commit is contained in:
wukko 2024-05-16 21:34:48 +06:00
parent c6f1184e55
commit 40b00a9676
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -75,7 +75,7 @@ export default async function(obj) {
let fileUrlBase = selectedStream.url; let fileUrlBase = selectedStream.url;
let fileUrl = `${fileUrlBase}${fileUrlBase.includes("?") ? "&" : "?"}client_id=${clientId}&track_authorization=${json.track_authorization}`; let fileUrl = `${fileUrlBase}${fileUrlBase.includes("?") ? "&" : "?"}client_id=${clientId}&track_authorization=${json.track_authorization}`;
if (fileUrl.substring(0, 54) !== "https://api-v2.soundcloud.com/media/soundcloud:tracks:") if (!fileUrl.startsWith("https://api-v2.soundcloud.com/media/soundcloud:tracks:"))
return { error: 'ErrorEmptyDownload' }; return { error: 'ErrorEmptyDownload' };
if (json.duration > env.durationLimit * 1000) if (json.duration > env.durationLimit * 1000)