UNPKG

notmebotz-tools

Version:

Sebuah Tools yang berfungsi untuk mendownload Video atau Foto dari media sosial, serta sebagai tools yang berguna untuk aplikasi kamu seperti untuk BOT

31 lines (25 loc) 636 B
const fetch = require('node-fetch'); let ytdl2 = async (type, url) => { if (!url) throw new Error('URL is required'); if (type !== 'mp3' && type !== 'mp4') { throw new Error('Type must be either "mp3" or "mp4"'); } const apiUrl = `https://api.ferdev.my.id/downloader/yt${type}?link=${url}`; try { let res = await fetch(apiUrl); let json = await res.json(); return { author: "Herza", status: 200, type: type, dlLink: json.data.dlink }; } catch (error) { return { author: "Herza", status: 500, error: error.message }; } } module.exports = { ytdl2 }