Skip to content

Commit

Permalink
[ Jessi-md 4.8.5 ⏱️ ]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaweeshachamodx authored Jan 30, 2024
1 parent f26c8e9 commit bb401e6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions plugins/downloader-ig.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
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...`);
if (!/https?:\/\/(www\.)?instagram\.com\/(p|reel|tv)/i.test(args[0])) {
await m.react('🤨');
return m.reply(`Use example ${usedPrefix}${command} link`);
}

await m.react('🕥');

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

if (data.status) {
await conn.sendMessage(m.chat, { video: { url: data.data[0].download_link } }, m);
if (data.status && data.result) {

await conn.sendMessage(m.chat, { video: { url: data.result[0].url } }, { quoted: m });
return m.react('✅');
} 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.');
await m.react('😑');
}
}

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

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

0 comments on commit bb401e6

Please sign in to comment.