Instagram-private-api: VideoUpload

Created on 27 Mar 2017  路  6Comments  路  Source: dilame/instagram-private-api

Hi I tried the video upload from the README, but I'm getting an "Unhandled rejection ParseError: Not possible to parse API response" error. I had the same issue and it was b/c instagram won't allow metadata. Any suggestions or experience with this error?
Thanks

Most helpful comment

Photo upload worked for me. I'm getting a promise rejection error from video. I literally copied their example code.

Client.Session.create(device, storage, 'XXXXXX', 'XXXXXX')
.then(function(session) {
//console.log(session)

    console.log(__dirname + '\\test_image\\out1.mp4')
    // MP4 is the only supported format now, pull request for any other format welcomed! 
    Client.Upload.video(session, __dirname + '\\test_image\\out1.mp4', __dirname + '\\test_image\\out_im.jpg')
        .then(function(upload) {
            console.log('asdf')
            return Media.configureVideo(session, upload.uploadId, 'aaa', 4000.0);
        })
        /*
        .catch(function(error) {
            console.log(error)
        })
        */     
        .then(function(medium) {
            // we configure medium, it is now visible with caption 
            console.log(medium.params)
        })
        /*
        .catch(function(error) {
            console.log(error)
        })
        */        
})

All 6 comments

Hi is it even possible to upload videos and photos to Instagram?
because I think they don't allow this

Photo upload worked for me. I'm getting a promise rejection error from video. I literally copied their example code.

Client.Session.create(device, storage, 'XXXXXX', 'XXXXXX')
.then(function(session) {
//console.log(session)

    console.log(__dirname + '\\test_image\\out1.mp4')
    // MP4 is the only supported format now, pull request for any other format welcomed! 
    Client.Upload.video(session, __dirname + '\\test_image\\out1.mp4', __dirname + '\\test_image\\out_im.jpg')
        .then(function(upload) {
            console.log('asdf')
            return Media.configureVideo(session, upload.uploadId, 'aaa', 4000.0);
        })
        /*
        .catch(function(error) {
            console.log(error)
        })
        */     
        .then(function(medium) {
            // we configure medium, it is now visible with caption 
            console.log(medium.params)
        })
        /*
        .catch(function(error) {
            console.log(error)
        })
        */        
})

The problem is on the first step https://i.instagram.com/api/v1/upload/video/.
I call @IvanMMM :)
It seems like instagram changed API, because problem even not in video file.

The spell worked :)
Yeah, I got the same api error. I'l check it.

Found the problem. Now Insta requires fields "upload_media_width" && "upload_media_height". Any ideas how can we get it without heavy tools like ffmpeg and others?
We get the duration right from the buffer with this code:

var pos = buffer.indexOf(new Buffer('mvhd')) + 17;
var timeScale = buffer.readUInt32BE(pos, 4); pos += 4;
var duration = buffer.readUInt32BE(pos, 4); pos += 4;

Ideally, we need exact same code to get video w|h. Question is about buffer offsets.

Used 720x720 values. Not sure if insta even checks values we pass to it :)
Fixed in #189.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikitaulshin picture nikitaulshin  路  17Comments

zalkanorr picture zalkanorr  路  12Comments

LouenLeoncoeur picture LouenLeoncoeur  路  12Comments

DenisKrsk picture DenisKrsk  路  33Comments

dhillon2325 picture dhillon2325  路  14Comments