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 Upload #655
Video Upload #655
Conversation
I was going to work on this myself, but as it turns out, someone already had. Nice! This doesn't seem to be usable, though. Sure, this allows for uploading videos, but there's no way to actually tweet them. The |
Hello @obskyr ! I did not change anything else and it works fine for me :) |
Tip: You cannot send videos and images in a tweet. You can only send 1 video or 4 images max. |
Oh, the docs don't mention the Regardless, don't you think it should be easier to tweet videos with the API? It'd be way more dev-friendly if you could just tweet a video with a filename / file object and it'd handle the upload under the hood for you, like what is done with images. All that would be needed would be some checks to see whether a file is a video or an image, which is easy (basically just check the extension). |
Yes you're right ! Thanks! |
Thank you for awesome work, @Choko256. |
Hey, great work. I was just trying to find a solution to a GIF problem and ended up here. One thing that I found (since my code is python3): you're going to run into problems with the urllib import statement and the supported versions of python. Maybe change from:
to:
And then change lines 1444 & 1481 to just use |
Fails sometimes for me with following exception:
|
How large is the file you're trying to upload |
Found root cause:
I think the code should raise an exception if nloops > 999 and don't try to upload. Also explain to the method caller, that he/she needs to increase |
4k is too small as a default. Should probably be set to something more reasonable like 1MB. Rather than returning an error, if the user really wants a small chunk size, disallow any value smaller than 16K, so that it always succeeds. (Max size / 16K = 960 chunks) |
This is great and I would love to see it in Tweepy asap. But, what do you think about having a single media_upload function that's agnostic about file type? I think it would just need to have a single I mocked up these ideas (along with the change from @jeremylow and a Parser fix) here: fitnr@ca7fe53 |
* And safe import urllib in both py2/3 * rename methods to match API * DRY max sizes, put in class in case twitter changes them * use single media_upload for image and video, send to standard or * chunked upload based on mime type and size * finalize needs ModelParser, not RawParser
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -211,6 +212,60 @@ def media_upload(self, filename, *args, **kwargs): | |||
upload_api=True | |||
)(*args, **kwargs) | |||
|
|||
def video_upload(self, filename, *args, **kwargs): | |||
""" :reference https://dev.twitter.com/rest/reference/post/media/upload-chunked |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
cf54e31
to
d538993
Compare
@jason-hyland-heyhuman |
This comment has been minimized.
This comment has been minimized.
The video-upload branch / pull request #1486 should be complete now. |
Make tweepy handle MP4 videos upload according to the Twitter API documentation for chunked uploads :
https://dev.twitter.com/rest/public/uploading-media#chunkedupload