我想用API删除在Youtube从我的频道视频 [英] I want to delete a video from my channel on Youtube using the API

查看:171
本文介绍了我想用API删除在Youtube从我的频道视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code:

YouTubeService serv = new YouTubeService("myDeleteService", YOUTUBE_DEVELOPER_KEY);            
serv.setUserCredentials(USERNAME, PASSWORD);
YouTubeRequestSettings settings = new YouTubeRequestSettings(YOUTUBE_CHANNEL, YOUTUBE_DEVELOPER_KEY);
YouTubeRequest request = new YouTubeRequest(settings);
string feedUrl = String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads", YOUTUBE_CHANNEL);
Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + VideoId);
Video video = request.Retrieve<Video>(videoEntryUrl);
Video vid = (from vi in videoFeed.Entries
             where vi.VideoId == VideoId
             select vi).First<Google.YouTube.Video>();
request.Delete(vid);

在最后一行说明对象的参考code中断未设置为一个对象。

The code breaks on the last line stating that object reference is not set to an object.

推荐答案

这似乎是一个问题,内部的谷歌的YouTube API。我有良好的请求和视频对象相同的问题。 (谷歌API v1.9.0.0)

This appears to be an issue internal to the Google YouTube API. I'm having the same issue with good request and video objects. (Google API v1.9.0.0)

更新:退房克劳迪奥的回应如下。它是正确的。我收到一封电子邮件,从后面支持,忘了更新这样的回答:

UPDATE: check out Claudio's response below. It is correct. I received an email back from support and forgot to update this answer:

这个URI会失败: http://gdata.youtube.com/feeds/api/videos/+ VIDEOID

this uri will fail: "http://gdata.youtube.com/feeds/api/videos/" + videoID

这将工作: http://gdata.youtube.com/feeds/api/users/+帐户名+/上传/+ VIDEOID

this will work: "http://gdata.youtube.com/feeds/api/users/" + accountName + "/uploads/" + videoID

这篇关于我想用API删除在Youtube从我的频道视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆