Skip to content

Commit

Permalink
Merge pull request Guru322#46 from Guru322/fix
Browse files Browse the repository at this point in the history
FB,MEDIAFIRE DL FIXED
  • Loading branch information
Guru322 authored Jun 16, 2023
2 parents 4613e32 + dc7f780 commit 04da9d2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 68 deletions.
92 changes: 40 additions & 52 deletions plugins/dl-facebook.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,40 @@
import fg from 'api-dylux'
import fetch from 'node-fetch'
import { savefrom, facebookdl, facebookdlv2 } from '@bochilteam/scraper'
import fbDownloader from 'fb-downloader-scrapper'
let handler = async (m, { conn, args, command, usedPrefix }) => {
if (!args[0]) throw `THIS CMD CAN DOWNLOAD FB VIDEOS, EXAMPLE: ${usedPrefix + command}* https://fb.watch/fOTpgn6UFQ/`
if (!args[0].match(/www.facebook.com|fb.watch/g)) throw `*NOT A FB LINK, EXAMPLE: ${usedPrefix + command}* https://fb.watch/fOTpgn6UFQ/`
try {
m.reply(`*DOWNLOADING YOUR VIDEO , IT MAY TAKE SOMETIME DEPENDING ON SIZE*`)
let Rres = await fetch(`https://api.lolhuman.xyz/api/facebook?apikey=${lolkeysapi}&url=${args[0]}`)
let Jjson = await Rres.json()
let VIDEO = Jjson.result[0]
if (VIDEO == '' || !VIDEO || VIDEO == null) VIDEO = Jjson.result[1]
conn.sendFile(m.chat, VIDEO, 'error.mp4', `*HERE U GO*`, m)
} catch (err1) {
console.log('1 ' + err1)
try {
let ress = await fg.fbdl(args[0])
let urll = await ress.data[0].url
await conn.sendFile(m.chat, urll, 'error.mp4', '*HERE U GO*', m)
} catch (err2) {
console.log('2 ' + err2)
try {
let res = await fbDownloader(args[0])
for (let result of res.download) {
let ur = result.url
await conn.sendFile(m.chat, ur, 'error.mp4', '*HERE U GO*', m)}
} catch (err3) {
console.log('3 ' + err3)
try {
let vio = await fetch(`https://api.violetics.pw/api/downloader/facebook?apikey=beta&url=${args[0]}`)
let vioo = await vio.json()
let videovio = `${vioo.result.hd.url || vioo.result.sd.url}`
await conn.sendFile(m.chat, videovio, `error.mp4`, '*HERE U GO*', m)
} catch (err4) {
console.log('4 ' + err4)
try {
let res3 = await fetch(`https://latam-api.vercel.app/api/facebookdl?apikey=brunosobrino&q=${args[0]}`)
let json = await res3.json()
let url3 = await json.video
await conn.sendFile(m.chat, url3, 'error.mp4', '*HERE U GO*', m)
} catch (err5) {
console.log('5 ' + err5)
try {
const { result } = await facebookdl(args[0]).catch(async _ => await facebookdlv2(args[0])).catch(async _ => await savefrom(args[0]))
for (const { url, isVideo } of result.reverse()) await conn.sendFile(m.chat, url, `facebook.${!isVideo ? 'bin' : 'mp4'}`, '*HERE U GO*', m)
} catch (err6) {
console.log('6 ' + err6)
throw `*SOME ERRORED WE ARE TRYING HARD TO FIX ASAP*`
}}}}}}}
handler.command = /^(facebook|fb|facebookdl|fbdl|facebook2|fb2|facebookdl2|fbdl2|facebook3|fb3|facebookdl3|fbdl3|facebook4|fb4|facebookdl4|fbdl4|facebook5|fb5|facebookdl5|fbdl5)$/i
export default handler
import fg from 'api-dylux';

const handler = async (m, { conn, args, usedPrefix, command }) => {
if (!args[0]) {
throw `✳️ Please send the link of a Facebook video\n\n📌 EXAMPLE :\n*${usedPrefix + command}* https://www.facebook.com/Ankursajiyaan/videos/981948876160874/?mibextid=rS40aB7S9Ucbxw6v`;
}

const urlRegex = /^(?:https?:\/\/)?(?:www\.)?(?:facebook\.com|fb\.watch)\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i;
if (!urlRegex.test(args[0])) {
throw '⚠️ PLEASE GIVE A VALID URL.';
}

m.react(rwait);

try {
const result = await fg.fbdl(args[0]);
const tex = `
⊱ ─── {* GURU FBDL*} ─── ⊰
↳ *VIDEO TITLE:* ${result.title}
⊱ ────── {⋆♬⋆} ────── ⊰`;

const response = await fetch(result.videoUrl);
const arrayBuffer = await response.arrayBuffer();
const videoBuffer = Buffer.from(arrayBuffer);

conn.sendFile(m.chat, videoBuffer, 'fb.mp4', tex, m);
m.react(done);
} catch (error) {
console.log(error);
m.reply('⚠️ An error occurred while processing the request. Please try again later.');
}
};

handler.help = ['facebook <url>'];
handler.tags = ['dl'];
handler.command = /^((facebook|fb)(downloder|dl)?)$/i;
handler.diamond = true;

export default handler;

3 changes: 2 additions & 1 deletion plugins/dl-mediafire.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let handler = async (m, { conn, args, usedPrefix, command, isOwner, isPrems }) =
m.react(rwait)
let full = /f$/i.test(command)
let u = /https?:\/\//.test(args[0]) ? args[0] : 'https://' + args[0]
let ss = await (await fetch(global.API('nrtm', '/api/ssweb', { delay: 1000, url: u }))).buffer()
let ss = await (await fetch(`https://image.thum.io/get/fullpage/${u}`)).buffer()
let res = await mediafiredl(args[0])
let { url, url2, filename, ext, aploud, filesize, filesizeH } = res
let isLimit = (isPrems || isOwner ? limit : limit) * 1012 < filesize
Expand All @@ -36,3 +36,4 @@ handler.diamond = true
handler.premium = false

export default handler

22 changes: 7 additions & 15 deletions plugins/tools-ssweb.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@

import fetch from 'node-fetch'
let handler = async (m, { conn, command, args, text }) => {

if (!args[0]) return m.reply('✳️ Enter the URL of a page')
m.react(rwait)
let full = /f$/i.test(command)
let u = /https?:\/\//.test(args[0]) ? args[0] : 'https://' + args[0]
let ss = await (await fetch(global.API('nrtm', '/api/ssweb', { delay: 1000, url: u }))).buffer()
conn.sendFile(m.chat, ss, 'ssweb.png', '✅ Capture from the Page', m)
m.react(done)
}
handler.help = ['ssweb <url>']
let handler = async (m, { conn, command, args }) => {
if (!args[0]) return conn.reply(m.chat, '*[🔎] give url*', m)
let ss = await (await fetch(`https://image.thum.io/get/fullpage/${args[0]}`)).buffer()
conn.sendFile(m.chat, ss, 'error.png', args[0], m)}
handler.help = ['ss', 'ssf'].map(v => v + ' <url>')
handler.tags = ['tools']
handler.command = ['ssweb', 'ss', 'captura']


handler.command = /^ss(web)?f?$/i
export default handler

0 comments on commit 04da9d2

Please sign in to comment.