LucasMod

Spotify

Nov 17th, 2025
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.39 KB | Source Code | 0 0
  1. //By: π–§„ 𝐋𝐔𝐂𝐀𝐒 πŒπŽπƒ πƒπŽπŒπˆππ€ π–§„
  2. //Canal: https://whatsapp.com/channel/0029Vb69bDnAe5VmzSMwBH11
  3.  
  4. const axios = require('axios');
  5. const cheerio = require('cheerio');
  6.  
  7. async function baixarSpotify(url) {
  8. try {
  9. if (!url.includes('open.spotify.com')) throw new Error('URL invΓ‘lida.');
  10. const respostaRynn = await axios.get('https://spotmate.online/', {
  11. headers: {
  12. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
  13. }
  14. });
  15. const $ = cheerio.load(respostaRynn.data);
  16. const api = axios.create({
  17. baseURL: 'https://spotmate.online',
  18. headers: {
  19. cookie: respostaRynn.headers['set-cookie'].join('; '),
  20. 'content-type': 'application/json',
  21. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
  22. 'x-csrf-token': $('meta[name="csrf-token"]').attr('content')
  23. }
  24. });
  25. const [{ data: metadados }, { data: download }] = await Promise.all([
  26. api.post('/getTrackData', { spotify_url: url }),
  27. api.post('/convert', { urls: url })
  28. ]);
  29. return {
  30. ...metadados,
  31. url_download: download.url
  32. };
  33. } catch (erro) {
  34. throw new Error(erro.message);
  35. }
  36. }
  37.  
  38. module.exports = baixarSpotify
  39.  
  40. // Exemplo de uso:
  41. // baixarSpotify('https://open.spotify.com/track/6yID3RbYKiwn2p2LPz0OkK')
  42. // .then(console.log)
  43. // .catch(console.error);
Advertisement
Add Comment
Please, Sign In to add comment