如何通过tweepy在Twitter上传视频?
我尝试使用这种语法,但它不起作用:
file = sys.argv[2]
argfle = sys.argv[1]
fn = os.path.abspath('/var/www/html/Gambar/2.mp4')
API.update_with_media(fn, argfile)
输出:
tweepy.error.TweepError: Invalid file type for image: video/mp4
答案 0 :(得分:-1)
下面这行 from a similar question before 应该对您有所帮助。
upload_result = api.media_upload('/home/user/video.mp4')
api.update_status(status="test tweet", media_ids=[upload_result.media_id_string])