Skip to content

Commit

Permalink
insta
Browse files Browse the repository at this point in the history
  • Loading branch information
sataniceypz authored Aug 27, 2024
1 parent 533f449 commit fa7dc13
Showing 1 changed file with 15 additions and 31 deletions.
46 changes: 15 additions & 31 deletions plugins/insta.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,41 @@
const { izumi, mode, isUrl, getJson, parsedUrl } = require("../lib");

const config = require("../config");
const { izumi, mode, getJson } = require("../lib");

izumi({

pattern: 'insta ?(.*)',

pattern: 'insta ?(.*)',
fromMe: mode,

desc: 'Send all media from Instagram URL.',

type: 'downloader'
}, async (message, match) => {


match = match || message.reply_message.text;

}, async (message, match, client) => {

const instaUrl = match;

if (!instaUrl) {


if (!match) {
return await message.reply('Please provide an Instagram URL.');

}

try {



const instaUrl = match.trim();

try {

const mediaUrl = `https://api.eypz.c0m.in/aio?url=${encodeURIComponent(instaUrl)}`;

const mediaData = await getJson(mediaUrl);

console.log('Media Data:', mediaData);


if (!mediaData || !mediaData.medias || mediaData.medias.length === 0) {

return await message.reply('No media found for the provided URL.');

}


for (const media of mediaData.medias) {

console.log('Sending Media:', media.url);

await message.sendFromUrl(media.url);

}

} catch (error) {

console.error('Error fetching media:', error);

await message.reply('An error occurred while fetching media.');

}

});

0 comments on commit fa7dc13

Please sign in to comment.