Skip to content

Instantly share code, notes, and snippets.

@itzmesuhail143
Forked from SuhailTechInfo/instadl.js
Last active April 14, 2024 04:59
Show Gist options
  • Save itzmesuhail143/c508a7f1c9621ee836388f0b4e310276 to your computer and use it in GitHub Desktop.
Save itzmesuhail143/c508a7f1c9621ee836388f0b4e310276 to your computer and use it in GitHub Desktop.
let {smd,Config,prefix} = require("../lib")
let axios = require("axios")
const { instagram } = require("mumaker")
smd({
pattern: "insta",
alias:["ig"],
desc: "Downloads Instagram videos.",
category: "downloader",
filename: __filename,
use: '<add fb url.>'
},
async(message, text) => {
try{
if(!text || !text.startsWith("https://") ) return await message.send(`*_Please Give me Insta Video Url_*\n*Example _${prefix}insta https://www.instagram.com/p/Cz0sXIqRsaM/?igsh=MzRlODBiNWFlZA==_*`);
let url = text.split(" ")[0]
let iggg = text.split(" ")[1]
let type = ["img","pic","photo","image"].includes(iggg) ? "image" : "video"
let insta = await instagram(url)
if (!insta && !insta[0]) {
//for (let i=0;i<insta.length;i++) {
return await message.bot.sendFileUrl(message.chat, insta[0], Config.caption, message, { author: "Suhail-Md" }, type); //}
}else {
const { data } = await axios.get(`https://tools.betabotz.eu.org/tools/instagramdl?url=${url}`);
if(!data || !data.result || !data.result[0]) return message.send(`*_Video not found!_*`)
return await message.bot.sendFileUrl(message.chat, data.result[0]._url, Config.caption, message, { author: "Suhail-Md" },type);
}
}catch(e){await message.error(`${e}\n\ncommand: insta`,e,`*_Internel Error!_*`)}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment