goinsta icon indicating copy to clipboard operation
goinsta copied to clipboard

Fix upload photo

Open manslaughter03 opened this issue 5 years ago • 3 comments

Hi,

First thanks for the works.

I start to investigate upload photo bad request #281, i need this feature and not wanting to use another libray. So i try to fix this issue.

I got inspired by https://github.com/dilame/instagram-private-api/blob/master/src/repositories/upload.repository.ts#L18.

  • I use the same endpoint /rupload_igphoto/${name} instead of /upload/photo/
  • I add some headers, like : X-Instagram-Rupload-Params, Offset, X-Entity-Length.
  • I use application/octet-stream as Content-Type
  • The same for configure request i add some value in config

I add an example: examples/upload-photo/main.go, I have to update goinsta import, for test purpose i import my repository.

If you have time to review my code and test this fix in your environment.

Thanks.

manslaughter03

manslaughter03 avatar Jan 25 '20 12:01 manslaughter03

Hi, I have applied goinsta like format and added uploadPhoto as a method to media. See my latest commits:

https://github.com/alidhkh/goinsta/commit/1cf9cce5138a438f0b696879f506a14384021d2e https://github.com/alidhkh/goinsta/commit/6303666efb13428a752ee29ab063da59f5ef64b8 https://github.com/alidhkh/goinsta/commit/6089bca86dab3844e07b01922bed4b8fcae541e3

alidhkh avatar Feb 14 '20 10:02 alidhkh

Hi, i think we should take an io.Reader as parameter on uploadPhoto function, we should remove postPhoto and use only uploadPhoto ? Otherwise it's good idea to add switchCookiesBetweenDomains. I'm going to commit your changes in my fork and test it.

manslaughter03 avatar Feb 16 '20 15:02 manslaughter03

Hey, uploadPhoto is not only used in uploading a new photo to feed, but also in changing profile picture, sending a new story, or sending someone a new photo message; as far as I know. Therefore, I think it's better to have a single uploadPhoto function that accepts a file name, for a reader we have to read the file each time before passing it to uploadPhoto.

alidhkh avatar Feb 16 '20 16:02 alidhkh