我正在尝试将一些YouTube功能集成到我的网站中。我可以拉进我上传的文件。当我循环浏览结果时,我看到视频不是只读的。
然而,当我去更新视频时,我使用特定视频的视频提要,返回readonly = TRUE!!
我使用相同的设置和请求,我用来拉在上传饲料,所以我不知道为什么这是不工作。
调试时,我正在获得视频,但它在. update()行上抛出对象引用错误。
Dim settings As New YouTubeRequestSettings("exampleapp", BusinessLayer.Constants.YOUTUBE_DEV_KEY, Session("token"))
Dim ytRequest As New YouTubeRequest(settings)
Dim videoEntryUrl As String = "http://gdata.youtube.com/feeds/api/videos/" & litVideoId.Text
Dim v As Video = ytRequest.Retrieve(Of Video)(New Uri(videoEntryUrl))
If v IsNot Nothing Then
v.Title = txtTitle.Text.Trim
ytRequest.Update(Of Video)(v)
End If
有人看到或处理过这个吗?想法吗?也许我错过了什么?
谢谢!
我认为您正在获得对象引用错误,因为路径。请看下面的例子:
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/users/default/uploads/" + 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);