forked from Shizu-Hub/Shizu-Bot-MD
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathdownloader-yta.js
24 lines (24 loc) Β· 1.54 KB
/
downloader-yta.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { youtubedl, youtubedlv2, youtubedlv3 } from '@bochilteam/scraper'
import fetch from 'node-fetch'
let handler = async (m, { conn, args }) => {
if (!args[0]) throw '*[βπππ
πβ] πΈπ½ππ΄πππ΄ π΄π» π²πΎπΌπ°π½π³πΎ πΌπ°π π΄π» π΄π½π»π°π²π΄ / π»πΈπ½πΊ π³π΄ ππ½ π
πΈπ³π΄πΎ π³π΄ ππΎππππ±π΄*'
await m.reply(`*_β³Sα΄ α΄sα΄α΄ α΄Κα΄α΄α΄sα΄Ι΄α΄
α΄ Sα΄ α΄α΄α΄
Ιͺα΄...β³_*\n\n*β SΙͺ Sα΄ α΄α΄α΄
Ιͺα΄ Ι΄α΄ α΄s α΄Ι΄α΄ Ιͺα΄α΄
α΄, α΄Κα΄α΄Κα΄ α΄α΄Ι΄ α΄Κ α΄α΄α΄α΄Ι΄α΄
α΄ #playdoc α΄ #play.2 α΄ #ytmp4doc β*`)
try {
let q = '128kbps'
let v = args[0]
const yt = await youtubedl(v).catch(async _ => await youtubedlv2(v)).catch(async _ => await youtubedlv3(v))
const dl_url = await yt.audio[q].download()
const ttl = await yt.title
const size = await yt.audio[q].fileSizeH
await conn.sendFile(m.chat, dl_url, ttl + '.mp3', null, m, false, { mimetype: 'audio/mp4' })
} catch {
try {
let lolhuman = await fetch(`https://api.lolhuman.xyz/api/ytaudio2?apikey=85faf717d0545d14074659ad&url=${args[0]}`)
let lolh = await lolhuman.json()
let n = lolh.result.title || 'error'
await conn.sendFile(m.chat, lolh.result.link, `${n}.mp3`, null, m, false, { mimetype: 'audio/mp4' })
} catch {
await conn.reply(m.chat, '*[β] π΄πππΎπ π½πΎ π΅ππ΄ πΏπΎππΈπ±π»π΄ π³π΄ππ²π°ππΆπ°π π΄π» π°ππ³πΈπΎ*', m)}
}}
handler.command = /^getaud|yt(a|mp3)$/i
export default handler