Hey I'd like to tweet a mp4 file generated using ffmpeg to twitter.
However it seems that there's no real native way to do this with the official tweepy.
When tried with the api.update_with_media(filename, message) method, you'll get an error, unsupported file 'video/mp4'
So first I saw a discussion where this github project was linked: Github link
But after testing out the code, the app crashs after the first INIT phase.
So next I saw this: Github pull request thread
And on that thread it was announced that there is a code to tweet video but it hasn't officialy been merged yet, and braian87b made a fork of tweepy with the code to upload videos.
However I have no idea how to install and use a fork of tweepy and how to actually use the code to tweet a video. Braian87b used this as an example code:
upload_result = api.media_upload('/home/user/video.mp4')
api.update_status(status="test tweet", media_ids=[upload_result.media_id_string])
Any help would be apreciated! :)
In the end I managed to understand it. Making a fork of my own (as the one braian87b provided was incompatible with the latest version of pip, which is what I used to install it), I was able to install the forked tweepy by using pip
pip install git+https://github.com/Spyder-exe/tweepy.git
and then the code that braian87b provided was in the end perectly good! So using this code
upload_result = api.media_upload('/home/user/video.mp4')
api.update_status(status="test tweet", media_ids=[upload_result.media_id_string])
And making sure to put the reply_to_status_id tag before the media_ids tag, I was able to upload videos to twitter with only minor annoyances.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With