YouTube API .NET C# 编辑视频问题

发布于 2024-11-05 17:34:31 字数 994 浏览 1 评论 0原文

我使用最新的 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(video); 时,我收到一条错误,指出未找到对象 - 类似的情况。缺什么?

I use the newest YouTube API to upload movies by my users. Upload works but I have problem with editing properties after that. I'm trying like this:

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

First of all video.ReadOnly = true so I the object is uneditable. When I'm trying to perform request.Update(video); I get an error that Object is not found - something like that. What is missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不气馁 2024-11-12 17:34:31

问题出在 URL 上,

Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + lblVideoID.Text);

我已通过将 URL 更改为

Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/users/default/uploads/" + lblVideoID.Text);

“尝试一下”来解决该问题,它会正常工作。

The problem is with the URL

Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + lblVideoID.Text);

I have fixed the issue by changing the URL to

Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/users/default/uploads/" + lblVideoID.Text);

Try it and it will work fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文