开发者

Exception in thread "main" java.lang.UnsupportedOperationException: Entry cannot be deleted

According to the Google Youtube Java API if I want to delete a video, first is to get the VideoEntry Object, then call it's delete;

http://code.google.com/apis/youtube/2.0/developers_guide_java.html

Document says to retrieve a specific video entry:

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

But when I call delet, it gives me the exception

videoEntry.delete();

Any now, I have to get the feeds, then loop through the videoFeed.getEntries() List to find the VideoEntry has the same videoID as I passed in.

VideoFeed videoFeed = service.getFeed(new URL( "http://gdata.youtube.com/feed/api/users/My Account/uploads"), VideoFeed.class);

Why the VideoEntry Obj in videoFeed.getEntries() List can call delete() function but not the VideoEntry Obj returned by service.getEntry function ????


osdir.com/ml/youtube-api-gdata/2010-01/msg00122.html
and there's more on groups.jonzu.com/z_tag/delete/page/3

imply the URL needs to be set to your account directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜