From 8129c47aca7bcead68c8992a2ad5092ebf36e203 Mon Sep 17 00:00:00 2001 From: anubiskun Date: Sun, 30 Oct 2022 17:00:14 +0700 Subject: [PATCH] Update v2.4.0-core-2.5 --- plugins/downloader.js | 451 +++++++++++++++++++++--------------------- 1 file changed, 223 insertions(+), 228 deletions(-) diff --git a/plugins/downloader.js b/plugins/downloader.js index 0277b76..d01237c 100644 --- a/plugins/downloader.js +++ b/plugins/downloader.js @@ -5,218 +5,213 @@ * https://github.com/anubiskun */ - const isUrl = require('is-url'); - const { fetchJson, durasiConverter, anureq } = require('../library/lib') - const moment = require('moment-timezone'); - const { yta, ytv, ytIdRegex } = require('../library/y2mate') - let youtube = require("youtube-search-api") - - module.exports = anuplug = async (m, anubis, { text, command, args, usedPrefix, mime, qmsg }) => { - switch (command) { - case 'instagram': - case 'ig': - { - if (!text) return m.reply(`*Example* : ${usedPrefix + command} https://www.instagram.com/p/Cisd6jEvFKp/?igshid=YmMyMTA2M2Y=`) - if (!isUrl(text)) return m.reply("coba cek lagi urlnya ngab!!!!!!!!!!"); - if (!/instagram/.test(text)) return m.reply("coba cek lagi urlnya ngab!!!!!!!!!!"); - m.reply(mess.wait); - try { - const {data: json, status} = await anureq('https://api-anubiskun.herokuapp.com/api/ig?url=' + encodeURIComponent(text)) - if (!status) return m.reply('command sementara lagi error ngab!\ncoba contact owner untuk di perbaiki') - if (!json.status) return m.reply('command sementara lagi error ngab!\ncoba contact owner untuk di perbaiki') - if (json.isHighlighted) { - if (json.user.is_verified == true) { - teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username} ✅\n*Full Name*: ${json.user.full_name}`; - } else { - teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username}\n*Full Name*: ${json.user.full_name}`; - } - if (json.selectedByStoryId) { - if (json.selectedByStoryId.type == "mp4") { - anubis.sendVideo(m.chat, json.selectedByStoryId.url, teks, m, json.selectedByStoryId.thumb) - } else if (json.selectedByStoryId.type == "jpg") { - anubis.sendImage(m.chat, json.selectedByStoryId.url, teks, m) - } else { - m.reply("command error, mohon lapor ke owner!"); - } - } else { - for (let i = 0; i < json.media.length; i++) { - if (json.media[i].type == "mp4") { - anubis.sendVideo(m.chat, json.media[i].url, teks, m, json.media[i].thumb) - } else if (json.media[i].type == "jpg") { - anubis.sendImage(m.chat, json.media[i].url, teks, m) - } else { - m.reply("command error, mohon lapor ke owner!"); - } - } - } - } else { - const time = moment - .unix(json.post.taken_at) - .format("DD-MM-YYYY HH:mm:ss"); - if (json.user.is_verified == true) { - teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username} ✅\n*Full Name*: ${json.user.full_name}`; - } else { - teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username}\n*Full Name*: ${json.user.full_name}`; - } - if (!json.post.title == "") - teks += `\n*Title*: ${json.post.title}`; - teks += `\n*Like*: ${json.post.like_count}`; - teks += `\n*Comment*: ${json.post.comment_count}`; - teks += `\n*Upload at*: ${time}`; - if (!json.post.play_count == "") - teks += `\n*Play Count*: ${json.post.play_count}`; - if (!json.post.view_count == "") - teks += `\n*View Count*: ${json.post.view_count}`; - if (!json.post.video_duration == "") - teks += `\n*Video Durasi*: ${ses(json.post.video_duration)}`; - if (!json.post.caption == "") - teks += `\n*Caption*: ${json.post.caption}`; - for (let i = 0; i < json.media.length; i++) { - if (json.media[i].type == "mp4") { - anubis.sendVideo(m.chat, json.media[i].url, teks, m, json.media[i].thumb) - } else if (json.media[i].type == "jpg") { - anubis.sendImage(m.chat, json.media[i].url, teks, m) - } else { - m.reply("command error, mohon lapor ke owner! "); - } - } - - } - } catch (err) { - console.err(err) - m.reply("error bwang, coba cek urlnya!"); - return - } - } - break; - case 'hago': - case 'hg': - { - if (!isUrl(text)) return m.reply(`*Example* : ${usedPrefix + command} https://i-863.ihago.net/d/HtSJY1`) - m.reply(mess.wait); - try { - let {data: hago, status} = await anureq('https://api-anubiskun.herokuapp.com/api/hago?url=' + text) - if (!status) return m.reply('Url Error ngab!') - if (!hago.status) return m.reply('Url Error ngab!') - let pesen = `「 HAGO VIDEO DOWNLOADER 」\n\n*Nick* : ${hago.nick}`; - pesen += `\n*Birth* : ${hago.birth}`; - pesen += `\n*Tag Name* : ${hago.tag_name}`; - pesen += `\n*Likes* : ${hago.likes}`; - if (hago.text) pesen += `\n*Caption* : ${hago.text}`; - if (hago.media[0].type == "mp4") { - anubis.sendVideo(m.chat, hago.media[0].url, pesen, m) - } else if (hago.media[0].type == "jpg") { - for (let i = 0; i < hago.media[0].url.length; i++) { - anubis.sendImage(m.chat, hago.media[0].url[i], pesen, m) - } - } else { - m.reply("url tidak mengandung media ngab!"); - } - } catch (err) { - console.err(err) - } - } - break; - case 'tiktok': - case 'tt': - { - if (!text) return m.reply(`Example : ${usedPrefix + command} https://vt.tiktok.com/ZSR4m5Uym/`); - if (!isUrl(text)) return m.reply("coba cek lagi urlnya ngab!"); - let uri = new URL(text) - m.reply(mess.wait) - try { - if (/tiktok/.test(uri.href)) { - let tiktok = await fetchJson('https://api-anubiskun.herokuapp.com/api/tiktok?url=' + encodeURIComponent(uri.href)) - if (tiktok.status){ - anubis.sendVideo(m.chat, tiktok.nowm[1].url, `「 TIKTOK DOWNLOADER 」\n*USERNAME* : ${tiktok.username}\n*Name* : ${tiktok.name}\n*CAPTION* : ${tiktok.caption}`, m) - } else { - let tt = await fetchJson('https://api.lolhuman.xyz/api/tiktok?apikey=lolirham123456&url=' + encodeURIComponent(uri.href)) - if (tt.status === 200 && typeof tt.result == 'object' && typeof tt.result.link == 'string') anubis.sendVideo(m.chat, tt.result.link, `「 TIKTOK DOWNLOADER 」\n*USERNAME* : ${tt.result.author.username}\n*Name* : ${tt.result.author.nickname}\n*CAPTION* : ${tt.result.title}\n*Duration* : ${durasiConverter(tt.result.duration)}\n*Play Count* : ${tt.result.statistic.play_count}\n*Like Count* : ${tt.result.statistic.like_count}\n*Share Count* : ${tt.result.statistic.share_count}\n*Comment Count* : ${tt.result.statistic.comment_count}`, m, tt.result.thumbnail) - } - } else { - m.reply('cek urlnya ngab!\nitu beneran link tiktok?') - } - } catch (err) { - console.err(err) - m.reply('Command error ngab!\nLapor ke Owner!') - } - } - break; - case 'jooxdl': - case 'jooxdownloader': - { - if (!text) return m.reply(`Example : ${usedPrefix + command} l6ZHajU7vS2zej0+x9KvMw==`); - if (isUrl(text)) return m.reply(`Example : ${usedPrefix + command} l6ZHajU7vS2zej0+x9KvMw==`); - m.reply(mess.wait) - try { - let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/jooxdownload?id=' + encodeURIComponent(text)) - if (!json.status) return m.reply(global.msg.err) - let media = json.anubis - anubis.sendImage(m.chat, media.imgSrc, `Title : ${media.msong}\nSinger : ${media.msinger}\nDurasi : ${media.duration}\nFile Size : ${media.size}\nPublic Time : ${media.public_time}\nExt : MP3\nResolusi : 128kbps`, m); - await anubis.sendMessage(m.chat, { audio: { url: media.mp3Url }, mimetype: "audio/mpeg", fileName: `${media.msong}.mp3` }, { quoted: m }); - } catch (err) { - console.err(err) - m.reply(global.msg.err) - } - } - break; - case 'jooxsearch': - case 'jooxs': - { - if (!text) return m.reply(`Example : ${usedPrefix + command} bunny girls 1nonly`); - m.reply(mess.wait) - try { - let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/jooxsearch?q=' + encodeURIComponent(text)) - if (!json.status) return m.reply(global.msg.err) - let pesane = `Result for : *${text}*\n\n*Download video by click button bellow*`; - let rows = [] - json.anubis.splice(json.anubis.length, json.anubis.length); - json.anubis.forEach((xres, i) => { - rows.push({ title: xres.name, description: `Artis List: ${xres.artis_list}\nDurasi: ${xres.duration}`, rowId: `${usedPrefix}jooxdl ${xres.id}` }) - }) - let secs = [ - { - title: 'RESULT', - rows: rows - } - ] - anubis.sendList(m.chat, "*[ JOOX SEARCH ]*", pesane, 'RESULT', secs, m) - } catch (err) { - console.err(err) - m.reply(global.msg.err) - } - } - break; - case 'soundcloudsearch': - case 'scs': - { - if (!text) return m.reply(`Example : ${usedPrefix + command} bunny girls 1nonly`); - m.reply(mess.wait) - try { - let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/soundcloud?q=' + encodeURIComponent(text)) - if (!json.status) return m.reply(global.msg.err) - let pesane = `Result for : *${text}*\n\n*Download video by click button bellow*`; - let rows = [] - json.anubis.splice(json.anubis.length, json.anubis.length); - json.anubis.forEach((xres, i) => { - rows.push({ title: xres.title, description: `Full Name: ${xres.full_name}\nUsername: ${xres.username}\nLink SC: ${xres.user_url}\nGenre : ${xres.genre}\nCreated: ${xres.created_at}\nDurasi: ${xres.duration}\nComment Count: ${xres.comment_count}\nLike Count: ${xres.likes_count}\nPlay Count: ${xres.playback_count}\nRepost Count: ${xres.reposts_count}\nDescription: ${xres.description}`, rowId: `${usedPrefix}fetch ${xres.urlmp3}` }) - }) - let secs = [ - { - title: 'RESULT', - rows: rows - } - ] - anubis.sendList(m.chat, "*[ SOUNDCLOUD SEARCH ]*", pesane, 'RESULT', secs, m) - } catch (err) { - console.err(err) - m.reply(global.msg.err) - } - } - break; - case 'ytmp3': - case 'yta': - { +const isUrl = require('is-url'); +const { fetchJson, durasiConverter, anureq } = require('../library/lib') +const moment = require('moment-timezone'); +const { yta, ytv, ytIdRegex } = require('../library/y2mate') +let youtube = require("youtube-search-api") + +module.exports = anuplug = async (m, anubis, { text, command, args, usedPrefix, mime, qmsg }) => { + switch (command) { + case 'instagram': + case 'ig': + { + if (!text) return m.reply(`*Example* : ${usedPrefix + command} https://www.instagram.com/p/Cisd6jEvFKp/?igshid=YmMyMTA2M2Y=`) + if (!isUrl(text)) return m.reply("coba cek lagi urlnya ngab!!!!!!!!!!"); + if (!/instagram/.test(text)) return m.reply("coba cek lagi urlnya ngab!!!!!!!!!!"); + m.reply(mess.wait); + try { + const { data: json, status } = await anureq('https://api-anubiskun.herokuapp.com/api/ig?url=' + encodeURIComponent(text)) + if (!status) return m.reply('command sementara lagi error ngab!\ncoba contact owner untuk di perbaiki') + if (!json.status) return m.reply('command sementara lagi error ngab!\ncoba contact owner untuk di perbaiki') + if (json.isHighlighted) { + if (json.user.is_verified == true) { + teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username} ✅\n*Full Name*: ${json.user.full_name}`; + } else { + teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username}\n*Full Name*: ${json.user.full_name}`; + } + if (json.selectedByStoryId) { + if (json.selectedByStoryId.type == "mp4") { + anubis.sendVideo(m.chat, json.selectedByStoryId.url, teks, m, json.selectedByStoryId.thumb) + } else if (json.selectedByStoryId.type == "jpg") { + anubis.sendImage(m.chat, json.selectedByStoryId.url, teks, m) + } else { + m.reply("command error, mohon lapor ke owner!"); + } + } else { + for (let i = 0; i < json.media.length; i++) { + if (json.media[i].type == "mp4") { + anubis.sendVideo(m.chat, json.media[i].url, teks, m, json.media[i].thumb) + } else if (json.media[i].type == "jpg") { + anubis.sendImage(m.chat, json.media[i].url, teks, m) + } else { + m.reply("command error, mohon lapor ke owner!"); + } + } + } + } else { + const time = moment + .unix(json.post.taken_at) + .format("DD-MM-YYYY HH:mm:ss"); + if (json.user.is_verified == true) { + teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username} ✅\n*Full Name*: ${json.user.full_name}`; + } else { + teks = `「 INSTAGRAM DOWNLOADER 」\n\n*Username*: ${json.user.username}\n*Full Name*: ${json.user.full_name}`; + } + if (!json.post.title == "") + teks += `\n*Title*: ${json.post.title}`; + teks += `\n*Like*: ${json.post.like_count}`; + teks += `\n*Comment*: ${json.post.comment_count}`; + teks += `\n*Upload at*: ${time}`; + if (!json.post.play_count == "") + teks += `\n*Play Count*: ${json.post.play_count}`; + if (!json.post.view_count == "") + teks += `\n*View Count*: ${json.post.view_count}`; + if (!json.post.video_duration == "") + teks += `\n*Video Durasi*: ${ses(json.post.video_duration)}`; + if (!json.post.caption == "") + teks += `\n*Caption*: ${json.post.caption}`; + for (let i = 0; i < json.media.length; i++) { + if (json.media[i].type == "mp4") { + anubis.sendVideo(m.chat, json.media[i].url, teks, m, json.media[i].thumb) + } else if (json.media[i].type == "jpg") { + anubis.sendImage(m.chat, json.media[i].url, teks, m) + } else { + m.reply("command error, mohon lapor ke owner! "); + } + } + + } + } catch (err) { + console.err(err) + m.reply("error bwang, coba cek urlnya!"); + return + } + } + break; + case 'hago': + case 'hg': + { + if (!isUrl(text)) return m.reply(`*Example* : ${usedPrefix + command} https://i-863.ihago.net/d/HtSJY1`) + m.reply(mess.wait); + try { + let { data: hago, status } = await anureq('https://api-anubiskun.herokuapp.com/api/hago?url=' + text) + if (!status) return m.reply('Url Error ngab!') + if (!hago.status) return m.reply('Url Error ngab!') + let pesen = `「 HAGO VIDEO DOWNLOADER 」\n\n*Nick* : ${hago.nick}`; + pesen += `\n*Birth* : ${hago.birth}`; + pesen += `\n*Tag Name* : ${hago.tag_name}`; + pesen += `\n*Likes* : ${hago.likes}`; + if (hago.text) pesen += `\n*Caption* : ${hago.text}`; + if (hago.media[0].type == "mp4") { + anubis.sendVideo(m.chat, hago.media[0].url, pesen, m) + } else if (hago.media[0].type == "jpg") { + for (let i = 0; i < hago.media[0].url.length; i++) { + anubis.sendImage(m.chat, hago.media[0].url[i], pesen, m) + } + } else { + m.reply("url tidak mengandung media ngab!"); + } + } catch (err) { + console.err(err) + } + } + break; + case 'tiktok': + case 'tt': + { + if (!text) return m.reply(`Example : ${usedPrefix + command} https://vt.tiktok.com/ZSR4m5Uym/`); + if (!isUrl(text)) return m.reply("coba cek lagi urlnya ngab!"); + let uri = new URL(text) + m.reply(mess.wait) + try { + if (/tiktok/.test(uri.href)) { + let tiktok = await fetchJson('https://api-anubiskun.herokuapp.com/api/tiktok?url=' + encodeURIComponent(uri.href)) + anubis.sendVideo(m.chat, tiktok.nowm[1].url, `「 TIKTOK DOWNLOADER 」\n*USERNAME* : ${tiktok.username}\n*Name* : ${tiktok.name}\n*CAPTION* : ${tiktok.caption}`, m) + } else { + m.reply('cek urlnya ngab!\nitu beneran link tiktok?') + } + } catch (err) { + console.err(err) + m.reply('Command error ngab!\nLapor ke Owner!') + } + } + break; + case 'jooxdl': + case 'jooxdownloader': + { + if (!text) return m.reply(`Example : ${usedPrefix + command} l6ZHajU7vS2zej0+x9KvMw==`); + if (isUrl(text)) return m.reply(`Example : ${usedPrefix + command} l6ZHajU7vS2zej0+x9KvMw==`); + m.reply(mess.wait) + try { + let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/jooxdownload?id=' + encodeURIComponent(text)) + if (!json.status) return m.reply(global.msg.err) + let media = json.anubis + anubis.sendImage(m.chat, media.imgSrc, `Title : ${media.msong}\nSinger : ${media.msinger}\nDurasi : ${media.duration}\nFile Size : ${media.size}\nPublic Time : ${media.public_time}\nExt : MP3\nResolusi : 128kbps`, m); + await anubis.sendMessage(m.chat, { audio: { url: media.mp3Url }, mimetype: "audio/mpeg", fileName: `${media.msong}.mp3` }, { quoted: m }); + } catch (err) { + console.err(err) + m.reply(global.msg.err) + } + } + break; + case 'jooxsearch': + case 'jooxs': + { + if (!text) return m.reply(`Example : ${usedPrefix + command} bunny girls 1nonly`); + m.reply(mess.wait) + try { + let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/jooxsearch?q=' + encodeURIComponent(text)) + if (!json.status) return m.reply(global.msg.err) + let pesane = `Result for : *${text}*\n\n*Download video by click button bellow*`; + let rows = [] + json.anubis.splice(json.anubis.length, json.anubis.length); + json.anubis.forEach((xres, i) => { + rows.push({ title: xres.name, description: `Artis List: ${xres.artis_list}\nDurasi: ${xres.duration}`, rowId: `${usedPrefix}jooxdl ${xres.id}` }) + }) + let secs = [ + { + title: 'RESULT', + rows: rows + } + ] + anubis.sendList(m.chat, "*[ JOOX SEARCH ]*", pesane, 'RESULT', secs, m) + } catch (err) { + console.err(err) + m.reply(global.msg.err) + } + } + break; + case 'soundcloudsearch': + case 'scs': + { + if (!text) return m.reply(`Example : ${usedPrefix + command} bunny girls 1nonly`); + m.reply(mess.wait) + try { + let json = await fetchJson('https://api-anubiskun.herokuapp.com/api/soundcloud?q=' + encodeURIComponent(text)) + if (!json.status) return m.reply(global.msg.err) + let pesane = `Result for : *${text}*\n\n*Download video by click button bellow*`; + let rows = [] + json.anubis.splice(json.anubis.length, json.anubis.length); + json.anubis.forEach((xres, i) => { + rows.push({ title: xres.title, description: `Full Name: ${xres.full_name}\nUsername: ${xres.username}\nLink SC: ${xres.user_url}\nGenre : ${xres.genre}\nCreated: ${xres.created_at}\nDurasi: ${xres.duration}\nComment Count: ${xres.comment_count}\nLike Count: ${xres.likes_count}\nPlay Count: ${xres.playback_count}\nRepost Count: ${xres.reposts_count}\nDescription: ${xres.description}`, rowId: `${usedPrefix}fetch ${xres.urlmp3}` }) + }) + let secs = [ + { + title: 'RESULT', + rows: rows + } + ] + anubis.sendList(m.chat, "*[ SOUNDCLOUD SEARCH ]*", pesane, 'RESULT', secs, m) + } catch (err) { + console.err(err) + m.reply(global.msg.err) + } + } + break; + case 'ytmp3': + case 'yta': + { if (!text.match(ytIdRegex) || !text) return m.reply(`Example : ${usedPrefix + command} https://youtube.com/watch?v=PtFMh6Tccag 128kbps`) m.reply(mess.wait) let quality = args[1] ? args[1] : "128kbps" @@ -296,19 +291,19 @@ break; } } - anuplug.help = ['instagram', 'hago', 'tiktok', 'jooxsearch', 'soundcloudsearch', 'ytsearch', 'ytmp3', 'ytmp4',] - anuplug.tags = ['downloader'] - anuplug.command = /^(ig|instagram|hago|hg|tiktok|tt|jooxdownloader|jooxdl|jooxsearch|jooxs|soundcloudsearch|scs|yta|ytmp3|ytv|ytmp4|yts|ytsearch)$/i - anuplug.isPremium = true - - function ses(secs) { - let sec_num = parseInt(secs, 10); - let hours = Math.floor(sec_num / 3600); - let minutes = Math.floor(sec_num / 60) % 60; - let seconds = sec_num % 60; - - return [hours, minutes, seconds] - .map((v) => (v < 10 ? "0" + v : v)) - .filter((v, i) => v !== "00" || i > 0) - .join(":"); - } \ No newline at end of file +anuplug.help = ['instagram', 'hago', 'tiktok', 'jooxsearch', 'soundcloudsearch', 'ytsearch', 'ytmp3', 'ytmp4',] +anuplug.tags = ['downloader'] +anuplug.command = /^(ig|instagram|hago|hg|tiktok|tt|jooxdownloader|jooxdl|jooxsearch|jooxs|soundcloudsearch|scs|yta|ytmp3|ytv|ytmp4|yts|ytsearch)$/i +anuplug.isPremium = true + +function ses(secs) { + let sec_num = parseInt(secs, 10); + let hours = Math.floor(sec_num / 3600); + let minutes = Math.floor(sec_num / 60) % 60; + let seconds = sec_num % 60; + + return [hours, minutes, seconds] + .map((v) => (v < 10 ? "0" + v : v)) + .filter((v, i) => v !== "00" || i > 0) + .join(":"); +} \ No newline at end of file