-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
533f449
commit fa7dc13
Showing
1 changed file
with
15 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | ||
|
||
} | ||
|
||
}); |