【问题标题】:youtube api get specific video returns readonlyyoutube api 以只读方式获取特定视频返回
【发布时间】:2013-01-14 18:55:30
【问题描述】:

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

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

谢谢!

【问题讨论】:

  • 你在开玩笑吗?一个-1为此?这是检索视频的提要。

标签: asp.net vb.net youtube youtube-api youtube.net-api


【解决方案1】:

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

 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);

【讨论】:

  • 你是对的。 gdata.youtube.com/feeds/api/users/USER_ID/uploads/VIDEO_ID 是正确的提要。谢谢!
  • 谢谢。不敢相信我的这篇文章得了-1。感谢您的帮助。
  • 是的,我不知道,很多人只是去劝阻人们并拒绝投票。我认为你的问题很好,我会支持你。
  • 好的,谢谢。我仍然不知道为什么它会在我拥有视频时返回只读,当我在搜索中提取提要时,它返回不是只读的。我看不出有什么区别,这可能是他们的一个错误。但是哦,好吧。再次感谢您的帮助。
猜你喜欢
  • 2015-08-02
  • 2014-11-20
  • 2015-09-03
  • 2013-10-30
  • 1970-01-01
  • 2016-08-23
  • 2016-02-29
  • 2017-10-09
  • 2020-11-04
相关资源
最近更新 更多