Question

i'm trying to integrate some youtube features into my site. i am able to pull in my uploads. when i loop thru the results, i see the videos are NOT readonly.

however, when i go to update a video, i use the video feed for a specific video which returns readonly = TRUE!!

i'm using the same settings and request that i was using to pull in the upload feed, so i'm not sure why this isn't working.

when debugging, i am getting the video, but it is throwing a object refererence error on the .Update() line.

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

Has anyone seen or dealt with this? Thoughts? Maybe i'm missing something?

Thanks!

Was it helpful?

Solution

I think you are getting object reference error because of the path. Please see my example below:

 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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top