【问题标题】:Video upload with Tweetinvi使用 Tweetinvi 上传视频
【发布时间】:2015-09-17 02:38:28
【问题描述】:

我正在使用 TweetInvi 在 Twitter 上发布视频。

TwitterCredentials.SetCredentials(token.Token,token.TokenSecret,ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager. AppSettings["ConsumerSecret"]);

var filePath = string.Format("{0}content\\participant\\video\\{1}.{2}", Request.PhysicalApplicationPath, p.video, "mp4");
byte[] file1 =System.IO.File.ReadAllBytes(filePath);

var tweet =  Tweetinvi.Tweet.CreateTweet(message);
tweet.AddMedia(file1, "video");            
var success = tweet.Publish();

推文发布成功。但视频文件丢失。 我使用了来自 tweetinvi twwet with media的代码

提前致谢。

【问题讨论】:

标签: c# twitter tweetinvi


【解决方案1】:

Twitter 正在使用一种新的视频上传机制。 Tweetinvi 尚未发布此功能,但它将在我今天发布的 Tweetinvi 0.9.8.2 中提供,其中包含此特定功能。

与此同时,请按照此link 中的说明进行操作(将标记阅读为已回答的解决方案)。


更新:

您现在可以通过 Tweetinvi 0.9.8.2 使用 VideoUploader。不幸的是,nuget 存在一些问题,因此您现在必须指定版本:

安装包 TweetinviAPI -Version 0.9.8.2

这是一个代码示例:

var binary = File.ReadAllBytes(@"C:\video.mp4");
var media = VideoUploader.UploadVideo(binary);
var tweet = Tweet.CreateTweet("hello" + Guid.NewGuid());
tweet.AddMedia(media);
var success = tweet.Publish();

干杯, 临维

【讨论】:

    猜你喜欢
    • 2016-10-23
    • 2017-02-26
    • 2017-02-08
    • 2016-01-12
    • 2017-11-02
    • 2010-11-07
    • 2015-03-25
    • 2016-02-12
    • 2020-02-27
    相关资源
    最近更新 更多