Last active
January 31, 2025 17:59
-
-
Save ZTRdiamond/b4250b5808416ec3ebfb90bb0b6874c3 to your computer and use it in GitHub Desktop.
Instagram downloader scrape!
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
| import axios from "axios"; | |
| /* | |
| Created by https://github.com/ztrdiamond ! | |
| Source: https://whatsapp.com/channel/0029VagFeoY9cDDa9ulpwM0T | |
| "Aku janji jika hapus watermark ini maka aku rela miskin hingga 7 turunan" | |
| */ | |
| async function igdl(url) { | |
| try { | |
| return await new Promise(async(resolve, reject) => { | |
| if(!/^https?:\/\/(?:www\.)?instagram\.com\/(?:p|reel|tv)\/[a-zA-Z0-9_-]+\/?.*/.test(url)) reject("invalid url input!"); | |
| const headers = { headers: { contentType: "application/json", origin: "https://publer.io", referer: "https://publer.io/" }}; | |
| axios.post("https://app.publer.io/hooks/media", { | |
| iphone: false, | |
| url | |
| }, headers).then(async res => { | |
| const task_id = res.data.job_id; | |
| const task = async() => (await axios.get("https://app.publer.io/api/v1/job_status/" + task_id, headers)).data; | |
| async function process() { | |
| const { status, payload } = await task() | |
| if(status === "complete") { | |
| if(payload[0].error) return reject(payload[0].error) | |
| const media = payload.map(d => ({ | |
| type: d.type, | |
| url: d.path, | |
| thumb: d.thumbnail | |
| })) | |
| return resolve({ | |
| success: true, | |
| media | |
| }) | |
| } | |
| setTimeout(process, 1000); | |
| } | |
| await process() | |
| }).catch(e => reject(e)) | |
| }) | |
| } catch (e) { | |
| return { | |
| success: false, | |
| errors: [e] | |
| } | |
| } | |
| } | |
| export default igdl; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Output:
Error: