0

我正在尝试将一些 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

有没有人看到或处理过这个?想法?也许我错过了什么?

谢谢!

4

1 回答 1

0

我认为由于路径,您会收到对象引用错误。请看下面我的例子:

 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);
于 2013-01-14T19:36:56.430 回答