【发布时间】:2011-06-09 04:50:41
【问题描述】:
根据Google Youtube Java API,如果我想删除视频,首先是获取VideoEntry Object,然后调用它的delete;
http://code.google.com/apis/youtube/2.0/developers_guide_java.html
文档说要检索特定的视频条目:
//My own function returns me the service Obj, and it works!
YouTubeService service = getYoutubeService();
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/MyVideoID";
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), VideoEntry.class);
但是当我调用 delete 时,它给了我异常
videoEntry.delete();
现在,我必须获取提要,然后循环遍历 videoFeed.getEntries() 列表以查找 VideoEntry 与我传入的 videoID 相同。
VideoFeed videoFeed = service.getFeed(new URL( "http://gdata.youtube.com/feed/api/users/My Account/uploads"), VideoFeed.class);
为什么videoFeed.getEntries() List 中的VideoEntry Obj 可以调用delete() 函数,而service.getEntry 函数返回的VideoEntry Obj 不能调用????
【问题讨论】:
-
好的,谢谢!这实际上是我的网址的错!我应该将 url 设置为我的帐户目录,然后我可以通过视频 ID Cheers 删除视频!
-
我会把它添加为答案,这样我就可以得到投票了。请采纳我的回答:)