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

How can i post video with tweepy? #800

Closed
maksymkv25 opened this issue Oct 17, 2016 · 8 comments
Closed

How can i post video with tweepy? #800

maksymkv25 opened this issue Oct 17, 2016 · 8 comments
Labels
API This is regarding Twitter's API Duplicate This is a duplicate Feature This is regarding a new feature Question This is a question

Comments

@maksymkv25
Copy link

Hello, i don't find video post in tweepy doc's, is it possible?
And if so, how can i upload video?

@fitnr
Copy link
Contributor

fitnr commented Oct 17, 2016

There's an open pull request (#672) languishing on this, but it's not currently part of the library. You can use the alternate version, though.

@maksymkv25
Copy link
Author

I try it. And have some problem with posting video
video = 'E:\\example.mp4' media = api.upload_chunked(video)
got it
Media(media_id=788066364296691712, expires_after_secs=86400, media_id_string='788066364296691712', video={'video_type': 'video/mp4'}, _api=<tweepy.api.API object at 0x0000000004421C18>, size=1291103)
and how to post? can explain please?

@fitnr
Copy link
Contributor

fitnr commented Oct 18, 2016

I guess the Tweepy docs are a little vague on updating with media. The Twitter docs provide some hints.

It would go like this:

media = api.upload_chunked(video)
api.update_status(status="Hello World!", media_ids=[media.media_id])

The media_ids param expects a list because one can upload up to four pictures.

@maksymkv25
Copy link
Author

Thank's)

2016-10-18 5:30 GMT+03:00 Neil Freeman notifications@github.com:

I guess the Tweepy docs are a little vague on updating with media. The Twitter
docs https://dev.twitter.com/rest/reference/post/statuses/update
provide some hints.

It would go like this:

media = api.upload_chunked(video)
api.update_status(status="Hello World!", media_ids=[media.media_id])

The media_ids param expects a list because one can upload up to four
pictures.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#800 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AL8tjKJzE2daUGpR987oFkxRHZKVWXJ3ks5q1C9YgaJpZM4KYdbZ
.

@staringispolite
Copy link

@fitnr What version is that in? I'm on 3.5.0 and I get AttributeError: 'API' object has no attribute 'upload_chunked'

@fitnr
Copy link
Contributor

fitnr commented Oct 13, 2017

It's not in any version, it's an open pull request. The one mentioned above has been superseded by #929.

@staringispolite
Copy link

staringispolite commented Oct 14, 2017

Poking back in to confirm that using the branch the PR came from in #929, I was able to get video upload working. Just found the directory pip installed tweepy in, and overwrote it with the /tweepy folder from the video_upload2 branch of https://github.com/conversocial/tweepy/

Note that there's a bug in Twitter's API where a video needs to finish processing before you can successfully tweet with it. Best workaround I found was time.sleep() between the upload and status update calls https://twittercommunity.com/t/why-not-valid-video/72486/3

It would be nice to handle this more elegantly in the library if/when video gets merged in, but a 10 second sleep has been working pretty reliably for me with 30 second mp4 clips. (5 seconds wouldn't always be enough time)

@Harmon758
Copy link
Member

Closing as duplicate of #640. See also #1180.

@Harmon758 Harmon758 added API This is regarding Twitter's API Duplicate This is a duplicate Feature This is regarding a new feature Question This is a question labels May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API This is regarding Twitter's API Duplicate This is a duplicate Feature This is regarding a new feature Question This is a question
Projects
None yet
Development

No branches or pull requests

4 participants