instagram4j: "400, Something went wrong" while posting photo
Hi,
I’m uploading a photo
instagram.sendRequest(new InstagramUploadVideoRequest(post.getFile(), post.getDescription()));
I’m 100% sure that post.getFile() return a valid FIle and post.getDescription() return a non null String and I’m getting this ugly error
2019-11-19 21:40:32 [scheduling-1] INFO org.brunocvcunha.instagram4j.Instagram4j - Sending request: org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest
2019-11-19 21:40:32 [scheduling-1] INFO org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest - URL Upload: https://i.instagram.com/api/v1/upload/photo/
2019-11-19 21:40:33 [scheduling-1] INFO org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest - Photo Upload result: 400, Something is wrong. Please check your input and try again.
2019-11-19 21:40:33 [scheduling-1] INFO org.brunocvcunha.instagram4j.requests.InstagramRequest - Reading InstagramConfigurePhotoResult from Something is wrong. Please check your input and try again.
2019-11-19 21:40:33.521 ERROR 4696 --- [ scheduling-1] a.tassinari.core.InstaService : Unrecognized token 'Something': was expecting ('true', 'false' or 'null')
at [Source: (String)"Something is wrong. Please check your input and try again."; line: 1, column: 10]
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Something': was expecting ('true', 'false' or 'null')
at [Source: (String)"Something is wrong. Please check your input and try again."; line: 1, column: 10]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804) ~[jackson-core-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:703) ~[jackson-core-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2853) ~[jackson-core-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1899) ~[jackson-core-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:757) ~[jackson-core-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4141) ~[jackson-databind-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4000) ~[jackson-databind-2.9.9.jar:2.9.9]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3004) ~[jackson-databind-2.9.9.jar:2.9.9]
at org.brunocvcunha.instagram4j.requests.InstagramRequest.parseJson(InstagramRequest.java:141) ~[instagram4j-1.11.jar:na]
at org.brunocvcunha.instagram4j.requests.InstagramRequest.parseJson(InstagramRequest.java:111) ~[instagram4j-1.11.jar:na]
at org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest.parseResult(InstagramUploadPhotoRequest.java:171) ~[instagram4j-1.11.jar:na]
at org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest.execute(InstagramUploadPhotoRequest.java:106) ~[instagram4j-1.11.jar:na]
at org.brunocvcunha.instagram4j.requests.InstagramUploadPhotoRequest.execute(InstagramUploadPhotoRequest.java:44) ~[instagram4j-1.11.jar:na]
at org.brunocvcunha.instagram4j.Instagram4j.sendRequest(Instagram4j.java:281) ~[instagram4j-1.11.jar:na]
at a.tassinari.core.InstaService.postPhoto(InstaService.java:67) [classes/:na]
at a.tassinari.core.InstaService.postFile(InstaService.java:44) [classes/:na]
at a.tassinari.core.Scheduler.schedule(Scheduler.java:41) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) [spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.2.0.M3.jar:5.2.0.M3]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_171]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_171]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_171]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
I tryed different versions (1.11, 1.12, 1.13) with no results
Can you help me?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 36
Hey all,
Sorry for delay! As I am very busy, it is hard to write, test, and validate code for long periods.
I am happy to say that I’ve decided to improve some of the core functions of the library that were not working. So far, I have gotten:
These are what I believe to be the main core functionalities and I’ve worked to improve the library by making requests use newer headers, and overall improve the library without (hopefully) much breaking changes. The PR will be posted soon once I tidy up my work. You can see progress over at my fork of the repo.
I am grateful of other instagram private api (namely instagram-php and instagram node.js) for doing much of the hard work! Again, once I have proper time, I would like to rewrite the library to be more intuitive for users and be easier to manage and add new features as time goes.
Hi all,
I looked into the issue, and I have successfully fixed the photo upload request. It is using the new endpoint per the php and node.js library. I just have to clean it up a bit, and make sure photo/album/story posting is fully working. I will make a pull request soon (as I am very busy!).
For now, enjoy this gist for a quick fix. https://gist.github.com/jvogit/a98b5e411ab7bc9a33a02d51267ac66c
Some remarks,
Thanks @jvogit for finding a solution.
I am not able to put everything together and test at this time, but if you are willing to open a PR, I am more than happy to review and merge it.
Thank @jvogit . I pulled the code from you forked version and it’s working now. Thank you very much for your help.
For challenge,
See #358
Just read the reply by jvogit above, I’m sure he will provide a reliable fix as soon as possible for him.
InstagramUploadPhotoRequest:
I think thats the public api, while these inofficial libraries use the private one by pretending to be an android device. Aside from that, the php & node.js libraries are working fine after they made the change i mentioned above.
https://www.instagram.com/developer/ Instagram is moving to a new API. All old libraries are dying. We must either look for another way (Silenum for example) or wait until there are new libraries supporting the new API
Same here…