且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 tweepy 发布 mp4 文件

更新时间:2023-01-25 15:53:03

最后我理解了.制作我自己的 fork(因为提供的一个 braian87b 与最新版本的 pip 不兼容,这是我用来安装它的),我能够使用 pip 安装 fork tweepy

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

然后braian87b提供的代码最终非常好!所以使用这个代码

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])

并确保将reply_to_status_id 标签置于 media_ids 标签之前,我能够将视频上传到推特,而只有轻微的烦恼.

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.