Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download Instagram Videos
// node instagram-dl.js BnmcJ-tnAey
const rest = require('restler')
const fs = require('fs')
const request = require('request')
rest.get(`https://www.instagram.com/p/${process.argv.slice(2)[0]}/?__a=1`).on('complete', function(data) {
var videoUrl = data.graphql.shortcode_media.video_url
var videoFilename = videoUrl.split("/")[videoUrl.split("/").length - 1]
Promise.resolve()
.then(() => new Promise((resolve, revoke) => {
let writeStream = fs.createWriteStream(`videos/${videoFilename}`)
writeStream.on('finish', resolve)
writeStream.on('error', revoke)
request(videoUrl).pipe(writeStream)
})
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.