Skip to content

Instantly share code, notes, and snippets.

@xbladev
Created February 18, 2026 16:17
Show Gist options
  • Select an option

  • Save xbladev/8b822dfb1b0d5c8d1f6fa7600cb0a190 to your computer and use it in GitHub Desktop.

Select an option

Save xbladev/8b822dfb1b0d5c8d1f6fa7600cb0a190 to your computer and use it in GitHub Desktop.
spotify dl spotitrack com
// Scraper
const tempDir = path.join(__dirname, 'temp_spotify');
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir);
const fileName = `spotify_${Date.now()}.mp3`;
const filePath = path.join(tempDir, fileName);
async function downloadSpotify(url) {
const targetApi = 'https://spotitrack.com/api/proxy/download';
const payload = {
url: url,
artist: "Spotify Downloader",
imageUrl: "https://i.scdn.co/image/ab67616d0000b273b14a016954baa06d8af0466e",
quality: "128",
title: "Downloaded Song"
};
try {
const response = await axios.post(targetApi, payload, {
headers: {
...getRandomHeaders(),
'Origin': 'https://spotitrack.com',
'Referer': 'https://spotitrack.com/'
},
responseType: 'arraybuffer'
});
fs.writeFileSync(filePath, Buffer.from(response.data));
return true;
} catch (error) {
console.error("Spotify Download Error:", error.message);
return false;
}
}
// CASE
case "spot": {
const spotifyUrl = args[0];
if (!spotifyUrl) return await reply1("Please provide a Spotify URL.");
await socket.sendMessage(sender, { react: { text: "🎧", key: msg.key } });
const tempDir = path.join(__dirname, 'temp_spotify');
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir);
const fileName = `spotify_${Date.now()}.mp3`;
const filePath = path.join(tempDir, fileName);
async function downloadSpotify(url) {
const targetApi = 'https://spotitrack.com/api/proxy/download';
const payload = {
url: url,
artist: "Spotify Downloader",
imageUrl: "https://i.scdn.co/image/ab67616d0000b273b14a016954baa06d8af0466e",
quality: "128",
title: "Downloaded Song"
};
try {
const response = await axios.post(targetApi, payload, {
headers: {
...getRandomHeaders(),
'Origin': 'https://spotitrack.com',
'Referer': 'https://spotitrack.com/'
},
responseType: 'arraybuffer'
});
fs.writeFileSync(filePath, Buffer.from(response.data));
return true;
} catch (error) {
console.error("Spotify Download Error:", error.message);
return false;
}
}
try {
const success = await downloadSpotify(spotifyUrl);
if (success) {
await reply1("Spotify Song Downloaded. Uploading...");
await socket.sendMessage(sender, {
audio: fs.readFileSync(filePath),
mimetype: 'audio/mpeg',
fileName: `Spotify_Music.mp3`
}, { quoted: msg });
await socket.sendMessage(sender, { react: { text: "✅", key: msg.key } });
fs.unlinkSync(filePath);
} else {
await reply1("Spotify Download Failed. Please check the URL.");
}
} catch (e) {
console.error(e);
await reply1("Error: " + e.message);
}
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment