buffpy
buffpy copied to clipboard
Video Not Supported
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.
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
It's actually 3 step process:
- GET on
https://publish.buffer.com/rpc
to getetag
- POST on
https://buffer-media-uploads.s3.amazonaws.com
to 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 asid
and also constructvideo[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
]
}
}