Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

Chunked upload method for gifs #41

Closed
positlabs opened this issue Aug 16, 2016 · 2 comments
Closed

Chunked upload method for gifs #41

positlabs opened this issue Aug 16, 2016 · 2 comments

Comments

@positlabs
Copy link

I've recently started uploading gifs to twitter, and I noticed that it fails randomly (like 1/10 attempts), even with small gifs. I looked into it, and Twitter recommends using the chunked upload endpoint for gifs.

https://dev.twitter.com/rest/media/uploading-media > Animated GIF recommendations

A GIF may fail during Tweet creation even if it is within the filesize limit. Adhere to the following constraints to improve success rates.

Resolution should be <= 1280x1080 (width x height)
Number of frames <= 350
Number of pixels (width * height * num_frames) <= 300 million
In order to get better support for larger GIFs, use the chunked upload endpoint with the media_category parameter. This allows the server to process the GIF file asynchronously, which is a requirement for processing larger files. Pass media_category=tweet_gif to enable async upload behavior for Tweets with an animated GIF.

What do you think about adding a method to support this behavior? It seems like we might be able to refactor Twitter.prototype.uploadVideo into a more generic method (like Twitter.prototype.chunkedMediaUpload) that accepts a media_type argument.

@reneraab
Copy link
Owner

This should do the trick. Could you please try to upload animated GIFs with the version on the branch "chunkedUpload"? I can't really test it right now.

@positlabs
Copy link
Author

Nice! Works perfectly.

@reneraab reneraab closed this as completed Sep 5, 2016
reneraab added a commit that referenced this issue Sep 5, 2016
* getAuthUrl options (#40)
* chunked upload for all media types (#41)
* unretweet endpoint (#42)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants