instagram-private-api icon indicating copy to clipboard operation
instagram-private-api copied to clipboard

Posting story results in 400 Bad request

Open maxbauer opened this issue 3 years ago • 3 comments

Bug Report

I was trying to upload an image into the story of my account. Login works as expected but when uploading the image into the story or as an album I'm getting a 400 error. Is anything known regarding this error?

Requirements

  • [x ] I've searched the Issues
  • [ x] I've read the basic concepts
  • [ x] I'm using the latest version
  • [ x] I've debugged my code using the DEBUG variable.

Platform

  • [ x] I'm using Node.js version v16.13.0
  • [ -] I'm using electron

Code

 await ig.publish.album(albumContent).catch(err => console.error(err)); // also throws the error below

...
  const fileToUpload = readFileSync(path);
        await ig.publish.story({
            file: fileToUpload
        }).catch(err => console.error(err)); // results in error below

Error and Output

IgResponseError: POST /rupload_igphoto/123....789_0_123...456 - 400 Bad Request; 
    at Request.handleResponseError (/Users/project/node_modules/instagram-private-api/src/core/request.ts:172:12)

maxbauer avatar Feb 14 '22 18:02 maxbauer

That means IG changed its API. #1573 , #1574 #1575 , #1567

kingbotss avatar Feb 25 '22 10:02 kingbotss

@maxbauer I had a similar issue posting a video:

IgResponseError: POST /rupload_igphoto/165.....3885_0_766....37 - 400 Bad Request; 
    at Request.handleResponseError (/root/sandbox/tws-ig-live/node_modules/instagram-private-api/src/core/request.ts:172:12)
    at Request.send (/root/sandbox/tws-ig-live/node_modules/instagram-private-api/src/core/request.ts:83:24)
    at UploadRepository.photo (/root/sandbox/tws-ig-live/node_modules/instagram-private-api/src/repositories/upload.repository.ts:23:22)
    at PublishService.video (/root/sandbox/tws-ig-live/node_modules/instagram-private-api/src/services/publish.service.ts:167:5)

And the problem was that I was using a png cover image, with a jpg one worked correctly. If I'm not mistaken the lib is hardcoding a jpg moz image format. What image format are you using?

NickCis avatar Apr 26 '22 17:04 NickCis

And the problem was that I was using a png cover image, with a jpg one worked correctly.

Docs don't mention this but only jpeg is accepted.

If I'm not mistaken the lib is hardcoding a jpg moz image format.

This just says, the image was compressed with mozjpeg which the android app uses.

Nerixyz avatar Apr 26 '22 17:04 Nerixyz