Created
May 10, 2026 13:34
-
-
Save ayashiiiyo/94c9dd041d6be4573712d780e41e7f82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const headers = { | |
| 'accept': '*/*', | |
| 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
| 'origin': 'https://snapinsta.to', | |
| 'referer': 'https://snapinsta.to/en/instagram-photo-downloader', | |
| 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) CriOS/135.0.7049.83 Mobile/15E148 Safari/604.1', | |
| 'x-requested-with': 'XMLHttpRequest' | |
| } | |
| const proxy = url => `https://cors.siputzx.my.id/${url}` | |
| async function snapinsta(url) { | |
| const verify = await fetch(proxy('https://snapinsta.to/api/userverify'), { | |
| method: 'POST', | |
| headers, | |
| body: new URLSearchParams({ url }) | |
| }) | |
| const verifyData = await verify.json() | |
| const cftoken = verifyData?.token || verifyData?.cftoken | |
| const search = await fetch(proxy('https://snapinsta.to/api/ajaxSearch'), { | |
| method: 'POST', | |
| headers, | |
| body: new URLSearchParams({ | |
| q: url, | |
| t: 'media', | |
| v: 'v2', | |
| lang: 'en', | |
| cftoken | |
| }) | |
| }) | |
| const json = await search.json() | |
| let decoded = '' | |
| global.eval = code => { | |
| decoded = code | |
| } | |
| Function(json.data)() | |
| const htmlMatch = decoded.match( | |
| /innerHTML\s*=\s*"([\s\S]*?)";/ | |
| ) | |
| if (!htmlMatch) { | |
| throw new Error('HTML tidak ditemukan') | |
| } | |
| const html = JSON.parse(`"${htmlMatch[1]}"`) | |
| const links = [ | |
| ...html.matchAll(/href="(https:\/\/[^"]+)"/g) | |
| ] | |
| .map(v => v[1]) | |
| .filter(v => | |
| v.includes('dl.snapcdn.app/get') | |
| ) | |
| const type = html.includes('icon-dlvideo') | |
| ? 'video' | |
| : 'image' | |
| return { | |
| type, | |
| data: type === 'video' | |
| ? links[0] | |
| : links | |
| } | |
| } | |
| let handler = async (m, { conn, args, command }) => { | |
| try { | |
| if (!args[0]) return m.reply(`*Example :* .${command} https://www.instagram.com/p/xxxx`) | |
| m.reply(global.wait) | |
| const res = await snapinsta(args[0]) | |
| if (res.type === 'video') { | |
| await conn.sendMessage(m.chat, { | |
| video: { | |
| url: res.data | |
| } | |
| }, { quoted: m }) | |
| } else { | |
| for (const url of res.data) { | |
| await conn.sendMessage(m.chat, { | |
| image: { | |
| url | |
| } | |
| }, { quoted: m }) | |
| } | |
| } | |
| } catch (e) { | |
| m.reply(e.message) | |
| } | |
| } | |
| handler.help = ['igdl', 'ig', 'instagram'] | |
| handler.command = ['igdl', 'ig', 'instagram'] | |
| handler.tags = ['downloader'] | |
| export default handler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Que chido, Gracias lo necesitaba uwu