Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Not Supported #23

Open
ishandutta2007 opened this issue Sep 2, 2019 · 2 comments
Open

Video Not Supported #23

ishandutta2007 opened this issue Sep 2, 2019 · 2 comments

Comments

@ishandutta2007
Copy link
Contributor

ishandutta2007 commented Sep 2, 2019

Well for video and a couple of other features I am trying to create a parallel post API which uses Content-Type": "application/json instead of Content-Type": "application/x-www-form-urlencoded but with little luck till now. Their web version uses Content-Type": "application/json for all requests so it should be feasible.

To explain the case bit more, media[photo]=some_photo_url is concatenated in photo case but for video case it needs a higher hierarchy ie media[video][details][location]=some_video_url.I don't know how to encode that in application/x-www-form-urlencoded(above multiple indexing as demonstrated doesn't work)

I will keep the action of this issue on myself, if anyone has idea feel free to discuss.
I will use the issue as my status book to keep anyone updated if interested and also to help me track my progress.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ishandutta2007 ishandutta2007 changed the title Video Not Support Video Not Supported Sep 3, 2019
@ishandutta2007
Copy link
Contributor Author

ishandutta2007 commented Sep 3, 2019

The way of sending media[video][details][location] using Content-Type": "application/x-www-form-urlencoded actually works. My bad that I said it doesn't . I have tested it with an old video(ie whose id I already knew from the web version), it works.
But for new videos there is still some work to be done. It doesn't work if the video is not in their s3 bucket. So I have to figure out how to make a request to first put the video in their s3 bucket(rather than mine) and then get the generated video id just like how they do via web. I will keep posting my findings. Views welcome

@ishandutta2007
Copy link
Contributor Author

ishandutta2007 commented Sep 3, 2019

It's actually 3 step process:

  • GET on https://publish.buffer.com/rpc to get etag
  • POST on https://buffer-media-uploads.s3.amazonaws.comto upload the video to s3 {s3_bucket_id}/{etag} with
key: {s3_bucket_id}/uploads/{1567502606048}-my-original-finename.mp4
Content-Type: video/mp4
  • POST on /1/updates/{post_id}/update.json
    (here we use the etag as id and also construct video[detail][location] with it)
    with media json like this:
 {
       "progress":100,
        "uploaded":True,
        "uploading_type":"video",
        "video":{
            "title": "some titile",
            "id": etag,
            "details":{
                  "location": "https://buffer-media-uploads.s3.amazonaws.com/{s3_bucket_id}/{etag}/doesntmatter.mp4",
                  "transcoded_location": "https://buffer-media-uploads.s3.amazonaws.com/{s3_bucket_id}/{etag}/doesntmatter.mp4",
                  "file_size":6767009,
                   "duration":27,
                   "duration_millis":26611,
                   "width":480,
                   "height":270
             },
             "thumbnails":[
                   photo_link,
                   photo_link2
             ]
          }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant