Skip to content

Commit

Permalink
Update downloader-ig.jsl
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteshadowofficial authored Jan 19, 2024
1 parent 868b826 commit ce50535
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions plugins/downloader-ig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ import fetch from 'node-fetch';
let handler = async (m, { conn, args, usedPrefix, command }) => {
if (!/https?:\/\/(www\.)?instagram\.com\/(p|reel|tv)/i.test(args[0])) throw m.reply(`Use example ${usedPrefix}${command} link`);
await m.reply(`Loading...`);
let tes = await fetch(`https://inrl-web.onrender.com/api/insta?url=${args[0]}`);
const json = await tes.json();
const igdl = json.result;
await conn.sendFile(m.chat, igdl, 'error.mp4', '❤️ done here', m);

try {
let response = await fetch(`https://vihangayt.me/download/instagram2?url=${args[0]}`);
let data = await response.json();

if (data.status) {
await conn.sendMessage(m.chat, { video: { url: data.data[0].download_link } }, m);
} else {
throw new Error('Error in response data');
}
} catch (error) {
console.error('Error:', error.message);
m.reply('Failed to fetch Instagram data. Please try again later.');
}
}

handler.help = ['ig'].map(v => v + ' <url>')
handler.tags = ['downloader']

handler.command = /^(ig(dl)?|insta|instagram(dl)?)$/i

export default handler
export default handler;

0 comments on commit ce50535

Please sign in to comment.