我使用最新的YouTube API上传我的用户的电影。上传工作但我在此之后编辑属性有问题。我这样想:
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", YTDeveloperKey, YTUser, YTPassword);
settings.Timeout = 10000000;
YouTubeRequest request = new YouTubeRequest(settings);
Google.YouTube.Video video = new Google.YouTube.Video();
//video.VideoId = lblVideoID.Text;
//http://gdata.youtube.com/feeds/api/users/USER_ID/uploads/VIDEO_ID
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + lblVideoID.Text);
video = request.Retrieve<Google.YouTube.Video>(videoEntryUrl);
if (video.ReadOnly == false)
{
}
string tt = video.Title;
string dd = video.Description;
video.Title = tbTitle.Text;
video.Description = tbDescription.Text;
video.Keywords = tbKeywords.Text;
//video.Status.Value = "private";
request.Update(video);
首先是video.ReadOnly = true所以我的对象是不可编辑的。当我正在尝试执行request.Update(视频);我得到一个错误,找不到对象 - 就像那样。缺少什么?
答案 0 :(得分:0)
问题在于网址
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + lblVideoID.Text);
我已修正此问题,方法是将网址更改为
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/users/default/uploads/" + lblVideoID.Text);
尝试一下,它会正常工作。