instagram-private-api
instagram-private-api copied to clipboard
Posting story results in 400 Bad request
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)
That means IG changed its API. #1573 , #1574 #1575 , #1567
@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?
And the problem was that I was using a
png
cover image, with ajpg
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.