Ytmp4

javascript 48 views Mar 28, 2026
Raw
javascript 39 lines ยท 1,101 chars
const axios = require("axios")

const pluginConfig = {
    name: 'ytmp4',
    alias: ['youtubemp4', 'ytvideo', 'yt4'],
    category: 'download',
    description: 'Download video YouTube',
    usage: '.ytmp4 <url>',
    example: '.ytmp4 https://youtube.com/watch?v=xxx',
    cooldown: 20,
    energi: 1,
    isEnabled: true
}

async function handler(m, { sock }) {
    const url = m.text?.trim()
    if (!url) return m.reply(`Contoh: ${m.prefix}ytmp4 https://youtube.com/watch?v=xxx`)
    if (!url.includes('youtube.com') && !url.includes('youtu.be')) return m.reply('โŒ URL harus YouTube')

    m.react('๐Ÿ••')

    try {
        const { data } = await axios.get(`https://api.nexray.web.id/downloader/ytmp4?url=${url}&resolusi=720`)
        await sock.sendMedia(m.chat, data.result.url, data.result.title, m, {
            type: 'video',       
        })
        m.react('โœ…')

    } catch (err) {
        console.error('[YTMP4]', err)
        m.react('โŒ')
        m.reply('Gagal mengunduh video.')
    }
}

module.exports = {
    config: pluginConfig,
    handler
}