Created
March 21, 2025 16:30
-
-
Save Mr-rabbit-xd/7d99b840dc8729a47892d2f8008c7096 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { yts, isUrl, youtube, System } = require('../lib/'); | |
System({ | |
pattern: '1video', | |
fromMe: true, | |
desc: 'YouTube video downloader', | |
type: 'download' | |
}, async (message, match) => { | |
match = match || message.reply_message?.text; | |
if (!match) return await message.reply('_Give a YouTube video *Url* or *Query*_'); | |
const videoUrl = (await extractUrlsFromText(match))[0]; | |
if (isUrl(videoUrl)) { | |
const { title, url } = await youtube(videoUrl, "video"); | |
await message.reply(`_*Downloading* ${title}*_`); | |
return await message.send({ url }, { caption: 'Download by MR- Rabbit', quoted: message.data }, 'video'); | |
} else { | |
const { url } = (await yts(match))[0]; | |
const videoData = await youtube(url, "video"); | |
await message.reply(`_*Downloading* ${videoData.title}*_`); | |
return await message.send({ url: videoData.url }, { caption: 'Download by MR- Rabbit', quoted: message.data }, 'video'); | |
} | |
}); | |
System({ | |
pattern: 'gan', | |
fromMe: true, | |
desc: 'YouTube audio downloader', | |
type: 'download' | |
}, async (message, match) => { | |
match = match || message.reply_message?.text; | |
if (!match) return await message.reply('_Give a YouTube audio *Url* or *Query*_'); | |
const audioUrl = (await extractUrlsFromText(match))[0]; | |
if (isUrl(audioUrl)) { | |
const { title, url } = await youtube(audioUrl, "audio"); | |
await message.reply(`_*Downloading* ${title}*_`); | |
return await message.send({ url }, { caption: 'Download by MR- Rabbit', quoted: message.data }, 'audio'); | |
} else { | |
const { url } = (await yts(match))[0]; | |
const audioData = await youtube(url, "audio"); | |
await message.reply(`_*Downloading* ${audioData.title}*_`); | |
return await message.send({ url: audioData.url }, { caption: 'Download by MR- Rabbit', quoted: message.data }, 'audio'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment