Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
AleXD0009 authored Sep 15, 2024
1 parent 8ea268d commit b1541f5
Showing 1 changed file with 32 additions and 24 deletions.
56 changes: 32 additions & 24 deletions plugins/downloader-spotifydl.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import Starlights from '@StarlightsTeam/Scraper'
import fetch from 'node-fetch'
import Starlights from '@StarlightsTeam/Scraper';
import fetch from 'node-fetch';

let handler = async (m, { conn, text }) => {
if (!text) throw `🚩 Ingresa el enlace de algún Track, PlayList o Álbum de Spotify.`;
let isSpotifyUrl = text.match(/^(https:\/\/open\.spotify\.com\/(album|track|playlist)\/[a-zA-Z0-9]+)/i);
if (!isSpotifyUrl && !text) throw `🚩 Ingresa el enlace de algún Track, Playlist o Álbum de Spotify.`
await m.react('🕓')
if (!text) return conn.reply(m.chat, '🚩 Ingresa el enlace de algún Track, Playlist o Álbum de Spotify.', m);

let isSpotifyUrl = text.match(/^(https:\/\/open\.spotify\.com\/(album|track|playlist)\/[a-zA-Z0-9]+)/i);
if (!isSpotifyUrl) return conn.reply(m.chat, '🚩 Ingresa un enlace válido de Track, Playlist o Álbum de Spotify.', m);

await m.react('🕓')
try {
let { title, artist, album, thumbnail, dl_url} = await Starlights.spotifydl(text)
let img = await (await fetch(`${thumbnail}`)).buffer()
let txt = `*乂 S P O T I F Y - D O W N L O A D*\n\n`
txt += ` ✩ *Titulo* : ${title}\n`
txt += ` ✩ *Album* : ${album}\n`
txt += ` ✩ *Artista* :${artist}\n\n`
txt += `*- ↻ Los audios se estan enviando espera un momento, soy lenta. . .*`
await conn.sendFile(m.chat, img, 'thumbnail.jpg', txt, m)
await conn.sendMessage(m.chat, { audio: { url: dl_url }, fileName: title + '.mp3', mimetype: 'audio/mp4' }, { quoted: m })
await m.react('✅')
let { title, artist, album, thumbnail, dl_url } = await Starlights.spotifydl(text);
let img = await (await fetch(thumbnail)).buffer();

let txt = `*乂 S P O T I F Y - D O W N L O A D*\n\n`;
txt += ` ✩ *Título* : ${title}\n`;
txt += ` ✩ *Álbum* : ${album}\n`;
txt += ` ✩ *Artista* : ${artist}\n\n`;
txt += `*- ↻ Los audios se están enviando, espera un momento. . .*`;

await conn.sendFile(m.chat, img, 'thumbnail.jpg', txt, m);
await conn.sendMessage(m.chat, { audio: { url: dl_url }, fileName: `${title}.mp3`, mimetype: 'audio/mp4' }, { quoted: m });

await m.react('✅');
} catch {
await m.react('✖️')
}}
handler.help = ['spotifydl']
handler.tags = ['downloader']
handler.command = ['spotifydl']
//handler.limit = 1
handler.register = true
export default handler
await m.react('✖️');
}
};

handler.help = ['spotifydl'];
handler.tags = ['downloader'];
handler.command = ['spotifydl'];
// handler.limit = 1; // Si necesitas limitar el uso del comando
handler.register = true;

export default handler;

0 comments on commit b1541f5

Please sign in to comment.